Hello there,
I’m new to forex, and at the moment interested about indicators and EAs. I have some understanding about mq4 code, but im not coder and thats not enough yet to get what i want. So i would like to ask advice/help from experts or people who knows enough about mq4 coding. My current task is add custom indicator to EA, and by the way i got a nice EA template (think) im going to share it with you Ok so, my final buy/sell signals from indicator are these: [I][B]g_ibuf_BUY[1][/B][/I] and [I][B]g_ibuf_SELL[1][/B][/I]
here part of code when indicator playing sound, pop up, sending email.
void Alert_PlaySound_SendMail() {
string ls_ms = "MS PRO";
if (g_ibuf_BUY[1] == Low[1] - Arrow_Distance * Point && gi_flag_alert != Time[0]) {
if (Alert_PopUp_On) Alert(ls_ms + ": BUY | " + Symbol() + " " + TfToStr(Period()) + " | ", TimeToStr(TimeLocal(), TIME_SECONDS), " | " + DoubleToStr(Ask, 4));
PlaySound(ProcessBuySound(Buy_Sound));
gi_flag_alert = Time[0];
if (Send_Email) {
SendMail(ls_ms + " Alert! ", Symbol() + " " + TfToStr(Period()) + " - BUY signal issued at " + TimeToStr(TimeLocal(), TIME_SECONDS) + " on " + TimeToStr(TimeCurrent(),
TIME_DATE) + " (Last price: " + DoubleToStr(Ask, 4) + ")" + "
Scalper PRO");
}
}
if (g_ibuf_SELL[1] == High[1] + Arrow_Distance * Point && gi_flag_alert != Time[0]) {
if (Alert_PopUp_On) Alert(ls_ms + ": SELL | " + Symbol() + " " + TfToStr(Period()) + " | ", TimeToStr(TimeLocal(), TIME_SECONDS), " | " + DoubleToStr(Ask, 4));
PlaySound(ProcessSellSound(Sell_Sound));
gi_flag_alert = Time[0];
if (Send_Email) {
SendMail(ls_ms + " Alert! ", Symbol() + " " + TfToStr(Period()) + " - SELL signal issued at " + TimeToStr(TimeLocal(), TIME_SECONDS) + " on " + TimeToStr(TimeCurrent(),
TIME_DATE) + " (Last price: " + DoubleToStr(Ask, 4) + ")" + "
Scalper PRO");
}
}
}
But probably you can’t just use [I][B]g_ibuf_BUY[1][/B][/I] in EA so simple…?
And by the way this indicator uses many other indicators inside it self …
lda_Array[0] = ld_iRSI;
lda_Array[1] = RSILevelDown;
lda_Array[2] = RSILevelUp;
lda_Array[3] = ld_iCCI;
lda_Array[4] = istochastic_MODE_MAIN;
lda_Array[5] = istochastic_MODE_SIGNAL;
lda_Array[6] = istochastic_ModeManual;
lda_Array[7] = Osc_Shift0;
lda_Array[8] = Osc_Shift1;
lda_Array[9] = Osc_Shift2;
lda_Array[10] = Osc_Shift3;
lda_Array[11] = idemarker_4;
lda_Array[12] = idemarker_5;
lda_Array[13] = idemarker_6;
lda_Array[14] = idemarker_7;
lda_Array[15] = idemarker_8;
lda_Array[16] = idemarker_9;
lda_Array[17] = idemarker_10;
lda_Array[18] = idemarker_11;
lda_Array[19] = idemarker_12;
lda_Array[20] = istochastic_MODE_MAIN;
lda_Array[21] = istochastic_MODE_SIGNAL;
if (Manual) lda_Array[22] = ld_DownOscLevel;
else lda_Array[22] = ld_DownOscLevel/100;
if (Manual) lda_Array[23] = ld_UpOscLevel;
else lda_Array[23] = ld_UpOscLevel/100;
lda_Array[24] = ld_iWPR;
lda_Array[25] = WPRLevelDown;
lda_Array[26] = WPRLevelUp;
lda_Array[27] = ld_iDeMarker;
lda_Array[28] = DeMarkerLevelDown;
lda_Array[29] = DeMarkerLevelUp;
lda_Array[30] = istochastic_Bias2;
lda_Array[31] = ld_Manual;
lda_Array[32] = CCILevelUp;
lda_Array[33] = CCILevelDown;
lda_Array[34] = ld_iMAFast;
lda_Array[35] = ld_iMASlow;
Next step would be how to correct add these signals to EA template? Mhmm how… Do i have to use iCustom function? Really have no clue. Any help will be appreciated. Please don’t post docs.mql4.com links i was there. Thank you.
I tried add this to EA template no luck.
double value1[]; #property indicator_color1 Black
double value2[]; #property indicator_color2 Black
value1[0] = iCustom( NULL, 0, "MarketScalper", 0, 0 );
value2[0] = iCustom( NULL, 0, "MarketScalper", 1, 0 );
if (value1[1] > value2[0]) {if(reversesignals)buy=true;else sell=true;}
if (value2[1] < value2[0]) {if(reversesignals)sell=true;else buy=true;}