one signal per bar

 
hi all, i need some guide on writing a code, can anyone show me suggestion and how i do it?
what i want is i have a few indicators, and then i only want a signal coming out from each bar for 3 different indicators

so for one bar, maximum signal i get is 3 and then i trade once only with each signal(3trade)

conclusion=1signal got from each indicator for each bar, trade only once with each signal 

also does anyone use fractal signal to trade, i cant get it to work

double fractalup=iFractals(NULL, 0, MODE_UPPER, 3); 
int fsignal;						//fractalsignal
      {
      double close1 = iClose(Symbol(),0,bar);
      if (close1 > fractalup)
         {
         fsignal=1;					//buy
         }
      
      if (close1 < fractaldown) 
         {
         fsignal=2;					//sell
         }     
      }

 or can anyone lead me to a long detailed description article so i can learn it?

 

I coded an EA a little while ago which used fractal patterns. I decided not to pursue fractals any further upon completion of the EA.

upper and lower fractal patterns:

   
// upper fractal pattern

   if((High[2]>High[1])&&(High[2]>High[3])&&(High[2]>High[0])&&(High[2]>High[4])){bool upper fractal = true;}

// lower fractal pattern

   if((Low[2]<Low[1])&&(Low[2]<Low[3])&&(Low[2]<Low[0])&&(Low[2]<Low[4])){bool lower fractal = true;}

fractal pattern indicator

Thank you.

 

hi, about the fractal pattern indicator, can you explain to me how i extract the value to get into my ea?

i would like to ordersend buy just one point above the most recent upfractal after 4-10 bars, how do i do that?

is it possible to store it value? 

 

shenlongming,

Personally, I wouldn't extract and incorporate the fractal indicator into my EA for signals, I would simply use the fractal patterns I provided you as signal parameters.

Why go to the trouble of incorporating a custom indicator into your EA when you can use the parameters that the custom indicator uses instead of the custom indicator itself ?


shenlongming - "i would like to ordersend buy just one point above the most recent upfractal after 4-10 bars, how do i do that?"

Your strategy requires the use of an array so you can save the value of the middle upper fractal. You could wait until upper fractal formation has formed, declare a Boolean as true, then once the Boolean is true, then you would save the value of the upper middle fractal bar to an array. Once this value is saved to an array, you would create a block of code that would check to see if Boolean is true and if High[0] has crossed above the upper middle fractal bar value (which is saved to the array), so your EA would check to see if High[0] crossed above the array value. When all parameters have been cleared and an order is ready to be sent, you would declare the Boolean as false, replace the current value in the array to zero, and send a buy order.

Ask yourself, is this strategy worth the trouble?

Thank you.

 
WhooDoo22:

shenlongming,

Personally, I wouldn't extract and incorporate the fractal indicator into my EA for signals, I would simply use the fractal patterns I provided you as signal parameters.

Why go to the trouble of incorporating a custom indicator into your EA when you can use the parameters that the custom indicator uses instead of the custom indicator itself ?


shenlongming - "i would like to ordersend buy just one point above the most recent upfractal after 4-10 bars, how do i do that?"

Your strategy requires the use of an array so you can save the value of the middle upper fractal. You could wait until upper fractal formation has formed, declare a Boolean as true, then once the Boolean is true, then you would save the value of the upper middle fractal bar to an array. Once this value is saved to an array, you would create a block of code that would check to see if Boolean is true and if High[0] has crossed above the upper middle fractal bar value (which is saved to the array), so your EA would check to see if High[0] crossed above the array value. When all parameters have been cleared and an order is ready to be sent, you would declare the Boolean as false, replace the current value in the array to zero, and send a buy order.

Ask yourself, is this strategy worth the trouble?

Thank you.



well, about the strategy, what i wish is to do is a robot that enter trade once fractal is break, is there any easy to do that beside of what i mention?

about the fractal pattern, i mean how do i used it as signal parameter that i can use in ea 

 

Honestly shenlongming I don't believe this strategy will produce a consistent profit long-term using fractal breakouts alone. Just my 2-cents of my experience coding fractals.


"is there any easy to do that beside of what i mention?"

Possibly, but I am not aware of an easy way to do this.


"about the fractal pattern, i mean how do i used it as signal parameter that i can use in ea"

// upper fractal pattern

   if((High[2]>High[1])&&(High[2]>High[3])&&(High[2]>High[0])&&(High[2]>High[4])){bool upper fractal = true;}

// lower fractal pattern

   if((Low[2]<Low[1])&&(Low[2]<Low[3])&&(Low[2]<Low[0])&&(Low[2]<Low[4])){bool lower fractal = true;}

What you wish to do might take a great deal of time to code, so consider this task that you are about to undertake before you undertake it.

Thank you.

 
close this topic, refer to https://www.mql5.com/en/forum/141839
Reason: