Newcomer wants advice/help :)

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 :slight_smile: 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. :confused:


   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;}

Newbies should learn first and spent proper time in learning to perform better trading in real account. Demo account is the best platform newbies can practice and develop their trading skills.

shanza,
You could very well have just discussed Napoleon’s Egyptian campaign as it would have been just as relevant to the OP’s query.

otnepx,
There are really not too many coders or EA users at BP (myself included) where generic trading discussion is much more prevalent. Someone may be able to give you an answer but you may want to consider asking at another forum such as Codebase where the focus is actually on programming.

Forex Trading Platform MetaTrader 4. Try their forum

First of all i think this question should go into the EA robot section on the forum.Second of all i`m a grandmaster EA coder lucky to have me here :5:, and you can ask me anything for free, but i guess you should also register here:
MQL4: automated trading forum
For free mql4 coding help and learn mql4 language from here:
MQL4 Documentation
Also add me there friend:
Profile ‘Proximus’ - MQL4.community

Secondly you don’t just use variables to import indicators into the ea thats not how it works, also the template file is irrelevant for the EA.To import custom indicator into the robot you must use the iCustom function after copying all indicators into your indicator folder on the MT4, in this case the indicator.mq4 .
So use it like this man:
this is how it explains in the editor:
double iCustom( string symbol, int timeframe, string name, …, int mode, int shift) ;

this is how you use it for buffer 0

[B]double BUYSIGN=iCustom(Symbol(),0,"indicator",0,1);[/B]

this is how you use it for buffer 1

[B]double SELLSIGN=iCustom(Symbol(),0,"indicator",1,1);[/B]

Using shift 1 for better accuracy of the previous closed candle,but if you must want the current candle use shift 0.
Now from what i see the buffer 1 is the sell and the buffer 0 is the buy so its easy to test like this is how you test it:

[B]if(BUYSIGN!=EMPTY_VALUE)
{buy=true;sell=false; }// you can buy now
if(SELLSIGN!=EMPTY_VALUE)
{sell=true;buy=false; }// you can sell now[/B]

And of course the sell and buy variables are booleans so you should declare them at the beginning of the ea before all functions like this

[B]bool sell=false;
bool buy=false;[/B]

And before placing a buy or sell order test them to be true if they will be not then dont place the order.Simple as that :smiley: