Evaluate subsequent indicators only if the one before is satisfied. That way you avoid unnecessary computations and EAs that gobbles CPU.
if(IndicatorA()>=x)
if (indicatorB()=y)
if (indicatorC()<=z)
Use functions which only get evaluated if they get to that point, rather than variables which are precomputed whether they are required or not.
For the buy signals, try something like this the following. Use parameters which you can vary during testing to find the optimum. You may find that some indicators carry more weight. And depending on what the total weighting is, you may want to vary the lots. Again the thresholds are parameters you can test to find the optimum.
if(ImdicatorA>=x)
{
BuySignal=BuySignal+Weighting1
}
if(ImdicatorB=y)
{
BuySignal=BuySignal+Weighting2
}
if(ImdicatorC<=z)
{
BuySignal=BuySignal+Weighting3
}
If(BuySignal>ThresholdBig) ... // buy big lots
else If(BuySignal>ThresholdMedium) ...//buy medium lots
else If(BuySignal>ThresholdSmall) ...//buy small lots
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I'm writing an EA that's based on several indicators, now am I best writing it like this
if(IndicatorA>=x && indicatorB=y && indicatorC<=z)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,Slip,Ask-SL,Ask+TP,NULL,16180,0,Green)
}
Or the other way I though was
int BuySignal=0;
if(ImdicatorA>=x)
{
BuySignal=BuySignal+1
}
if(ImdicatorB=y)
{
BuySignal=BuySignal+1
}
if(ImdicatorC<=z)
{
BuySignal=BuySignal+1
}
If(BuySignal=3)
{
OrderSend(Symbol(),OP_BUY,Lots,Ask,Slip,Ask-SL,Ask+TP,NULL,16180,0,Green)
}
Obviously having different combinations of indicators and settings for buy, sell and close/modify orders. I've got a working version based on the first idea, which either trades far too often or not at all, but I'm thinking the second idea would allow me more control over when I trade and with what Lot size to choose. Has anyone designed a working EA that uses multiple indicators and if so what way is best? Or are there more efficient methods?