Expert Advicor Auto trading with Fractal

 

Dear All,

We have created autotrader with Fractal.There is one problemwe cannot solve.

The Ordersend function sending order until Fractal Up is not true. I need that It sent order just one time on each Fractal down.

Please check the code and let me know how can I solve this problem.

Files:
newco2.mq4  9 kb
 

Your "buffers" . . actually arrays as this is not an indicator, have a size of zero elements . . . you need to resize them.

Also, from here: https://www.mql5.com/en/articles/1456

"1. First of all we should not forget, that the function IndicatorCounted() does not work in Expert Advisors! "

 

You need a way to define Once per Fractal. Something like:

if( Fractal_Time != Last_Fractal_Time ){
    Ticket=OrderSend();
    if(  Ticket>0 ){  
        Last_Fractal_Time = Fractal_Time; 
    } 
}

Do a Google search for Once Per Bar. That should also give you some Ideas.

Other things wrong with your code:

2011.11.21 03:19:50     2011.01.02 23:00  newco2 EURUSD,M5: SetIndexBuffer function must be called from custom indicator only

And

2011.11.21 03:19:51     2011.01.02 23:15  newco2 EURUSD,M5: OrderModify error 1
I'll recommend you look through the Book.
 

So guys what can you exatly recommend me ?

About

" 2011.11.21 03:19:50 2011.01.02 23:00 newco2 EURUSD,M5: SetIndexBuffer function must be called from custom indicator only " I know and this is not problem..

I need just it sent the order per Fractal. I cannot solve this problem for some days.

It is sending order if Down Fractal is active until Up Fractal is active

 
I've already made my recommendations. If you don't understand the codes I provided. Then maybe you should use the Book. I find coding to be like math class. You cannot implement Fractions until you understand Divisions. You cannot implement Division unless you understand subtraction. Jumping ahead and hoping to figure it out is a bad idea.
 
extrader:

So guys what can you exatly recommend me ?

Giving dCurrent a value somewhere in your code might help . . .
Reason: