APPRECIATE HELP IN DEBUGGING THIS PROGRAM

 

Dear all,

Programmers and traders and MQL5 users,

I have a request, if you can help me out please. Attached is an EA, I tried to code to convert an indicator in an order placing EA. But its encountering the following error:

"OnCalculate function not found in custom indicator"

Attached is the indicator qpalla and the EA.

I just want to convert this indicator qpalla in an EA.

EA must:

1. Open long order when yellow circle blue line appears.

2. Close previous buys, open sell when yellow circle red line appears.

3. It would be good to have SL, TP, Enable, Disable option.

4. Pending orders: Buy limits, Sell limits, Buy stops, Sell stops, as an option with spacing between pending orders to be defined by me too as a Grid size.

Attached is the coding, if someone can help me get it do what I want, I will really appreciate the help.

Thank you

 
What about looking in your expert folder take one of Metaquotes' existing sample EA (like Moving Average.mq4) and replace the MACD-trigger by your triggers?
 

I did it, the errors are removed and the EA loads but when placed in tester for backtests gives no results.

Can you please see whats the problem and help me make this EA operate.

The criteria for opening and closing are above.

Thank you

Files:
EA_4.mq4  10 kb
 

Hello ,

Inside your indicator, there is a SetEmptyValue() which is 0


SetIndexEmptyValue(0, 0);

And inside your expert, you are looking fr condition like this one :

if(sell_maprevious!=EMPTY_VALUE && sell_macurrent==EMPTY_VALUE && buy_macurrent!=EMPTY_VALUE ) 
     {
      res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,0,0,"",MAGICMA,0,Red);
      return;
     }

This condition cannot be détected, because the empty_value cannot be found, modify for this and test :

if(sell_maprevious!= 0 && sell_macurrent== 0 && buy_macurrent!= 0  ) 
     {
     Print( "CONDITION SELL FOUNDED ");

      res=OrderSend(Symbol(),OP_SELL,LotsOptimized(),Bid,3,0,0,"",MAGICMA,0,Red);
      return;
     }

then  check the logs

 

Close conditions are not valid, in check_for_close,  add :

 double ma= iMA(NULL,0,10,0,3,0,1);
 
it work, you should ask help to complete the EA on some forum like forex factory or some other, where coder help people
 

Yes ffoorr, you are right about the empty value to be replaced by 0 and it works, the EA now opens orders but its all messed up.

Please if you can see if I have selected the modes and shift in Icustom indicator calling qpallada to be correct to perform the following and I dont need the MA, I was just using it as a template to convert this indicator in an EA, so I dont want the ma, how to remove it so that the EA does completely as I want:

1. Open long order when yellow circle blue line appears.

2. Close previous buys, open sell when yellow circle red line appears.

3. It would be good to have SL, TP, Enable, Disable option.

4. If SL hit wait for the reverse signal to open a new order.

I really appreciate your help, I have posted in forex factory too.

Thank you

Files:
EA_4.mq4  10 kb