I am a new Metatrader user who has some experience of coding, and am having a problem
I have a custom indicator that calculates the daily pivot points (R3, R2, R1, PP, S1, S2, S3) for the currency pair I am looking at. I am currently looking at 5 minute data. I have manually verified the levels, and everything appears to display correctly on the main charts.
I am trying to use these values within an EA to help generate entry and exit signals. I am using icustom to pull in the relevant 7 buffers from the custom indicator. For example:
double PP=iCustom(NULL,0,"PIVOT POINTS",0,3,0); // Calls Daily Pivot Point
Buffers range from Buffer0 (R3) down to Buffer6 (S3)
Buffer 3 is the fourth Buffer, so it is correctly looking at the pivot point. The Indicator is correctly named, and there are no external variables that need to be passed through to the indicator.
When I run the EA in visual mode, the Pivot points plotted on the new chart are very different from those on the main chart, even though the prices used to calculate the pivots are the same on each chart. Strangely, the few days of data displayed before the start of the EA seem to match up. But as soon as the EA starts, the values start to move away. The EA is using these incorrect values for trading triggers, and so it returns useless results.
Does anyone have any idea why the values pulled through in the EA would be different to those plotted directly by the custom indicator?
Thanks for your swift reply.
The Indicator does indeed display the pivot point for each Bar, for all data periods shown in the chart - It shows the pivot point for every trading day. Although I previously said that there are no external variables, I can confirm that there is 1, but that the value should be zero, so this is correct.
sorry for the delay in replying. I have found a far simpler piece of code that generates the pivot points within the EA, rather than calling from outside, and this has solved all of the problems.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.