I could be wrong here, I'm newer to programming EA's
Lets say you wanted to save the last 10 signals in your array. Set
int (or double if you have a decimal) SignalHisto[10];
Then realize that your index starts at zero so ...
SignalHisto[0] = "whatever your saving in the most recent index space";
SignalHisto[1] = "whatever your saving in the second most recent index space";
...
SignalHisto[9] = "whatever your saving in the 10th index space";
Hello,
This is just some code to show on a graph sell dots. I want to track the history of buy/sell signals in an array, so by default i assign "0" to "SignalHisto".
When there is a signal, the value gets 1.
Now i want to use the data stored in the array. If i put in the last "if" statement : if (SignalHisto[i] == 1) then i will have two signal displayed on my graph ON THE SAME BAR, the one from the first "if" and the one from the second "if" (buffer 6 & 7). That is fine. But when i put as in the code below "if (SignalHisto[i+1] == 1), i would expect for have two signals displayed on the chart on TWO CONSECUTIVE BARS... But the buffer 6 signal isn't displayed.
Any reason ? With the i+1 it doesn't work but with "i" that is fine. With the "i+1" i only have Buffer 7 signal displayed.
Thanks
Greg
So close together you can't see them. | ExtMapBuffer7[i] = High[i]+1*Point; //sell signal ExtMapBuffer6[i] = High[i]+2*Point; //sell signal |
Try a minimum of 5 pips difference | ExtMapBuffer7[i] = High[i]+1*Point; //sell signal ExtMapBuffer6[i] = High[i]+50*Point; //sell signal |
Thanks for answers, it's on DAX, so 1pt is enough to see it :)
The loop go forward i++
In fact the code works with "if (SignalHisto[i-1] == 1)" (so minus 1). It will give the signal on the bar before my sell condition.
It works "if (SignalHisto[i] == 1)", will give signal on my sell condition.
But i can't get it give the signal on i+1, so the bar after my sell condition.
Weird.
Thanks for answers, it's on DAX, so 1pt is enough to see it :)
The loop go forward i++
Dax is quoted as 9,406.91 http://daytrading.about.com/od/marketprofiles/a/ProfileDAX.htm says "Tick size / Minimum price change : 0.5
"
You are confusing mt4's Point (0.01) and MODE_TICKSIZE of 0.50 with the DAX "point" (1 point=2 ticks=1.00)
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
This is just some code to show on a graph sell dots. I want to track the history of buy/sell signals in an array, so by default i assign "0" to "SignalHisto".
When there is a signal, the value gets 1.
Now i want to use the data stored in the array. If i put in the last "if" statement : if (SignalHisto[i] == 1) then i will have two signal displayed on my graph ON THE SAME BAR, the one from the first "if" and the one from the second "if" (buffer 6 & 7). That is fine. But when i put as in the code below "if (SignalHisto[i+1] == 1), i would expect for have two signals displayed on the chart on TWO CONSECUTIVE BARS... But the buffer 6 signal isn't displayed.
Any reason ? With the i+1 it doesn't work but with "i" that is fine. With the "i+1" i only have Buffer 7 signal displayed.
Thanks
Greg