I have a strategy but no coding knowledge

Avatar
  • updated
  • Can't be answered


indicators needed are
1. Moving Average Period 12, Method (Linear weighted), Apply to (Close)
2. Moving Average Period 40, Method (Linear weighted), Apply to (High)
3. Moving Average Period 40, Method (Linear weighted), Apply to (Low)
4. Commodity channel Index(CCI), Period 50, Apply to (close) Levels: (0)
5. Commodity channel Index(CCI), Period 20, Apply to (close) Levels: (100, -100, 200, -200)
6. Relative Strength Index(RSI), Period 7, Apply to (weighted Close(HLCC/4), Levels: 30, 70
7. Stochastic Oscillator %K (100), %D (100), Slowing (5), Price field (Close/Close), Method (Exponential), Levels: 20, 80

conditions for buy
1. Linear weighted Moving Average 12 closed above Linear weighted Moving average 40 Low and Linear weighted Moving average 40 High
2. RSI value must be above 70.00
3. CCI (Period 50) value must be above 0.00
4. CCI (Period 20) value must be above 100.00
5 The stochastic oscillator main line value greater than signal value
6. Buy at the closure of the candle that meet up with the 1 to 5 conditions above
7. Stop loss below the low of bull candle that meet up with the 1 to 5
8. Exit trade when RSI < 70.00, CCI (20) < 0.00, Bearish Candle formed below Moving Average 12

Condition for Sell
Will be opposite of the buying conditions

Avatar
1
jay hu
Quote from ajayi oluwaseun

I just went through the Quick guide and got what I needed to do.....

thanks guys..... I will be back to feed you back how it got on the set file

#property indicator_chart_window

#property indicator_plots 0

#property indicator_buffers 2

#property indicator_color1 Green

#property indicator_color2 Red

// Define indicator handles

int ma12_handle, ma40_high_handle, ma40_low_handle, cci50_handle, cci20_handle, rsi_handle, stochastic_handle;

double ma12[], ma40_high[], ma40_low[], cci50[], cci20[], rsi[], stochastic_main[], stochastic_signal[];

double UpArrowBuffer[];

double DownArrowBuffer[];

// Define entry point function

int OnInit() {

// Initialize indicator handles

ma12_handle = iMA(NULL, 0, 12, 0, MODE_LWMA, PRICE_CLOSE);

ma40_high_handle = iMA(NULL, 0, 40, 0, MODE_LWMA, PRICE_HIGH);

ma40_low_handle = iMA(NULL, 0, 40, 0, MODE_LWMA, PRICE_LOW);

cci50_handle = iCCI(NULL, 0, 50, PRICE_CLOSE);

cci20_handle = iCCI(NULL, 0, 20, PRICE_CLOSE);

rsi_handle = iRSI(NULL, 0, 7, PRICE_WEIGHTED);

stochastic_handle = iStochastic(NULL, 0, 100, 100, 5, MODE_SMA, 1);

IndicatorBuffers(2);

SetIndexStyle(0, DRAW_ARROW);

SetIndexArrow(0, 241); // Code 241 is the symbol for an up arrow

SetIndexBuffer(0, UpArrowBuffer);

SetIndexLabel(0, "Buy signal");

SetIndexStyle(1, DRAW_ARROW);

SetIndexArrow(1, 242); // Code 242 is the symbol for a down arrow

SetIndexBuffer(1, DownArrowBuffer);

SetIndexLabel(1, "Sell signal");

return(INIT_SUCCEEDED);

}

// Define the main indicator calculation

int OnCalculate(const int rates_total,

const int prev_calculated,

const datetime &time[],

const double &open[],

const double &high[],

const double &low[],

const double &close[],

const long &tick_volume[],

const long &volume[],

const int &spread[])

{

// Update indicator data

if(CopyBuffer(ma12_handle, 0, 0, rates_total, ma12) == -1 ||

CopyBuffer(ma40_high_handle, 0, 0, rates_total, ma40_high) == -1 ||

CopyBuffer(ma40_low_handle, 0, 0, rates_total, ma40_low) == -1 ||

CopyBuffer(cci50_handle, 0, 0, rates_total, cci50) == -1 ||

CopyBuffer(cci20_handle, 0, 0, rates_total, cci20) == -1 ||

CopyBuffer(rsi_handle, 0, 0, rates_total, rsi) == -1 ||

CopyBuffer(stochastic_handle, 0, 0, rates_total, stochastic_main) == -1 ||

CopyBuffer(stochastic_handle, 1, 0, rates_total, stochastic_signal) == -1)

{

Print("Failed to copy data. Error code = ", GetLastError());

return(-1);

}

// Check conditions for buy or sell

for(int i = 1; i < rates_total; i++)

{

// Buy conditions

if(ma12[i] > ma40_low[i] && ma12[i] > ma40_high[i] && rsi[i] > 70 && cci50[i] > 0 && cci20[i] > 100 && stochastic_main[i] > stochastic_signal[i])

{

Comment("Buy signal at ", time[i]);

UpArrowBuffer[i] = low[i] - 10 * Point; // Place the arrow 10 points below the low price

}

else

{

UpArrowBuffer[i] = EMPTY_VALUE;

}

// Sell conditions

if(ma12[i] < ma40_low[i] && ma12[i] < ma40_high[i] && rsi[i] < 30 && cci50[i] < 0 && cci20[i] < -100 && stochastic_main[i] < stochastic_signal[i])

{

Comment("Sell signal at ", time[i]);

DownArrowBuffer[i] = high[i] + 10 * Point; // Place the arrow 10 points above the high price

}

else

{

DownArrowBuffer[i] = EMPTY_VALUE;

}

}

return(rates_total);

}

Here is the rough code for the indicator based on your strategy, Ulises mentioned that it is better to create an indicator. The code still needs some work to fix errors to compile successfully. See if someone has time to help.

Avatar
0
ajayi oluwaseun

I just went through the Quick guide and got what I needed to do.....

thanks guys..... I will be back to feed you back how it got on the set file

Avatar
0
ajayi oluwaseun
Quote from Ulises Cune

what a waste of time for all of us

I can learn if only steps are given....

i got the message right, I know you are not pleased with me because of all these my slow grab.

sometimes it can be more frustrating than any other thing when a teacher is trying all possible best to teach his student and he is not grabbing.... 

my question is how do I install the CP EA at first?

Avatar
0
Sai Pratap
Quote from ajayi oluwaseun

i am lost totally, i understand nothing here

It cannot be explained any better than this!

Avatar
0
jay hu
Quote from ajayi oluwaseun

i am lost totally, i understand nothing here

YouTube and Google are good tools to learn some basic functions of MT5, I also recommend you ask questions on you.com to get the information you want. It is a good start.

Avatar
1
Ulises Cune

what a waste of time for all of us

Avatar
-1
ajayi oluwaseun
Quote from aramabdo

1- You should have CP EA first (install it from the market)

2- Right click on CommunityPower ea:

Image 5064

3- Select test.

4- In the below you will see "inputs" go through it:

Image 5065

5- Right click on any place there and click "Load" then select the set file you have.

Now click green button (start) to test it.

Please note the set for CP will works only with CP EA  and other EA has its own Set file

i am lost totally, i understand nothing here

Avatar
1
aramabdo
Quote from ajayi oluwaseun

Image 5063

I have watch many video on how to install and use the SET file, but i am still finding it difficult to implement here because i can see PRESET folder from the MQL5 folder......i need help regarding this

1- You should have CP EA first (install it from the market)

2- Right click on CommunityPower ea:

Image 5064

3- Select test.

4- In the below you will see "inputs" go through it:

Image 5065

5- Right click on any place there and click "Load" then select the set file you have.

Now click green button (start) to test it.

Please note the set for CP will works only with CP EA  and other EA has its own Set file

Avatar
0
Quote from ajayi oluwaseun

Image 5063

I have watch many video on how to install and use the SET file, but i am still finding it difficult to implement here because i can see PRESET folder from the MQL5 folder......i need help regarding this

Are you kidding me?

It doesn't matter where your set is, just load it from the Inputs tab of the tester / EA settings.

Avatar
0
ajayi oluwaseun

Image 5063

I have watch many video on how to install and use the SET file, but i am still finding it difficult to implement here because i can see PRESET folder from the MQL5 folder......i need help regarding this