Hi slipshod,slipshod wrote:Hi Andy, if its ok I'll add some code below (will edit this post when done) as a tide-over until you're back & can do the job properly. Don't worry mate, enjoy your holiday - we'll keep the fires burning until you're back
Edit: Ok firstly you'll need to add the following to the EA's code up the top - in v1.09 its at line 83 under the // candletiger comment.
Leave UseRSIInsteadOfStoch there, as it'll be used for dashboard display purposes - but no longer for the actual trading.Code: Select all
extern bool useAO = true; extern bool useStoch = true; extern bool useRSI = true;
Then line 2310-ish you'll see the function trendDirect() replace it with the following:-
A few things to note:-Code: Select all
bool trendDirect(string symbol, int type) { double mA = iMA(symbol, PERIOD_H4, 240, 0, MODE_LWMA, PRICE_OPEN, 0); double sT = iStochastic(symbol, PERIOD_H4, 5, 3, 3, MODE_LWMA, 1, MODE_SIGNAL, 0); double aO = GetAo(symbol, PERIOD_H4, 0); double aO1 = GetAo(symbol, PERIOD_H4, 1); double lO = iLow(symbol, PERIOD_H4, 0); double hO = iHigh(symbol, PERIOD_H4, 0); double gRSI = GetSlopeRSI(symbol, PERIOD_H4, 0); if (useStoch) { if (type == OP_BUY) { if (useBothForPullback) { if (lO > mA && sT < 20 && aO < 0 && aO1 < aO) return(true); } else if (lO > mA && sT < 20) return(true); } if (type == OP_SELL) { if (useBothForPullback) { if (hO < mA && sT > 80 && aO > 0 && aO1 > aO) return(true); } else if (hO < mA && sT > 80) return(true); } } if (useRSI) { if (type == OP_BUY) { if (useBothForPullback) { if (lO > mA && gRSI < RSITMAlowlevel && aO < 0 && aO1 < aO) return(true); } else if (lO > mA && gRSI < RSITMAlowlevel) return(true); } if (type == OP_SELL) { if (useBothForPullback) { if (hO < mA && gRSI > RSITMAhighlevel && aO > 0 && aO1 > aO) return(true); } else if (hO < mA && gRSI > RSITMAhighlevel) return(true); } } if (useAO) { if (type == OP_BUY && lO > mA && aO < 0 && aO1 < aO) return(true); else if (type == OP_SELL && hO < mA && aO > 0 && aO1 > aO) return(true); } return(false); }
Its not a choice whether to use Stoch or RSI. You can use both or either. Just make sure one of them at least is set to true.
Awesome Oscillator is used as a confirming measure for Stoch/RSI trades if you set useBothForPullback to true, or as an entry in its own right if you set useAO to true. Set both those to false and it won't be used at all. The AO needs to be in positive territory for a sell trade or negative for a buy trade, and it now needs to have moved closer to the other direction than the previous H4 candle as that's how I read Bob's rule in the manual.
Lastly if I've stuffed something up here by all means don't hesitate to point it out!
Edit: improved the logic a bit, separating out the useAO parts from the useStoch and useRSI. Should work exactly the same.
I was just looking though the code and cannot see the benefit of only being able to open an order in a 4H time envelope. While crossing the zero line.
If price continued, the EA would not be able to place orders after the first 4 Hour period of
crossing the zero line if using the AO as an order.
What's your opinion?
Thanks for all your help in this thread.
Andy