I have been trying to code very basic EAs to learn so I have an EA i am using that used an indicator using icustom. That works fine and I use it on 1m time period. But I have another indicator that I would like to use as a filter for long term trend (on 1h time frame).
How would I add this to the EA code, for example if an arrow short appears then all following trades placed by the EA must be short, if arrow long then all following trades must be long. Then if the EA tries to open a long position when the long term trend is short it wont allow it to.
Can anyone help me out with this, I have tried but the EA only opens trades when an arrow appear, repeatedly as it repaints. I need to just use it as a filter.
int timeframe, // [in] Timeframe. It can be any of ENUM_TIMEFRAMES enumeration values. 0 means the current chart timeframe.
double val = iCustom( NULL, PERIOD_H1, "SampleInd", 13, 1, 0 );
... but how can I set it to only to trake trades in
the direction if the arrow is down previously. The above will only count
on that bar is that right
I have variables that decide which way a trade will be placed, I need to use the above as a filter so not on any one bar, but on all bars after a directional arrow untill the next directional change ...
How do you expect anyone to be able to answer you, without any code or screenshots, so that we can understand what you are talking about?
So the EA will have both long and short signals on a 1m time frame but I want to use the indicator above on a larger time frame to filter the trades based on long term trend. I hope that makes a little more sense.
I've already informed you that to get the details from an indicator at a different time-frame, you just use the iCustom() function for that indicator but with a different value for the time-frame parameter as I shown in the example.
Are you not using iCustom() for one of your indicators already? It will be similar, but just use it for the other Indicator and at a different time-frame!
Since, you have not provided any code of yours, I am unable to provide any further information.
To add comments, please log in or register