The only way I have found to do that :
static int cpte_higher =0; double atr = iATR(NULL,0,500,i); if(High[i] >= High[i+1]) higher[i]= High[i]+0.25*atr; if(High[i] < High[i+1]) higher[i] = 0.0; if(higher[i] != 0.0 ) cpte_higher++; if(higher[i] == 0.0 ) cpte_higher=0; cpte_high[i] = cpte_higher; if( cpte_high[i+1] > 4.0 && cpte_high[i] == 0) mHigh[i] = High[i]+atr; else mHigh[i] = 0.0;
You have to use an array to count the higher high, but doing cpte_high[i]++; do not work;
one's have to use a static intermediary counter cpte_higher++;
then pass it to the array : cpte_high[i] = cpte_higher;
For the high only :
thanks ffoorr - i looked at your code and it seemed to be adding a dot to bars that were also lower highs? so i wasn't sure what the intention was. I also didn't quite understand the relevance of using ATR? can you elaborate further please?
WHR - i am not sure i follow that code - a little complex for me :( - if seemed to relate to picking swing tops/bottoms in a similar way to fractals? ie one would need to wait for the bars either side of the high or low to confirm the swing? I don;t really want to wait that long.
I have attached a pic that might explain better.
There are 5 lower lows, the fifth in this case being the signal bar, and the entry would be the bar afterwards (indicated by red arrow). I would like to be able to set an external variable to say 3 as a minimum, so that if there were more lower lows than that, the signal is still valid.
As the entry bar (current bar) is the other side of the signal bar i was using icustom with a shift of 1.
Would i be better off trying to count bars? and record this in a static variable where they meet the criteria?

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
I am trying to create a signal where the entry bar must appear after a certain number of higher highs or lower lows.
eg like an outside bar / inside bar / pin bar.
So affectively i want a check to make sure the bar is in a good "location" ie top or bottom of a swing for example.
I tried to using this code, which works to a degree, but it will only give my the high or low based on the mVal setting. ie if i set the mVal variable to 3 then only the third high or low is reported.
What i would like to do is make mVal be the minimum number of bars that need to be considered.
in the for loop i changed
to be >= mVAL but this didin't seem to make a difference.
Any ideas how i can make mVal effectively be the minimum value, so that when i use the icustom function in the EA, it then returns the last high or low even if there are a greater number of consecutive bars, than specified by mVal?
eg
thanks
Simon