I want to have a script with a logical OR. And, I don't know how to do it.
Let me give you my condition from a layman, mathematical prospective. Then, I will paste what the Strategy Wizard created as logical ANDs.
Layman, mathematical definition:
If (Fast SMA crosses above Slow SMA) OR
(Close > Fast SMA AND Close > Slow SMA)
Enter Long
This is what the Strategy Wizard created:
{
// Condition set 1
if (CrossAbove(SMA(FastMA), SMA(SlowMA), 1)
&& Close[0] > SMA(FastMA)[0]
&& Close[0] > SMA(SlowMA)[0])
{
EnterLong(OrderQty, "");
}
// Condition set 2
if (CrossBelow(SMA(FastMA), SMA(SlowMA), 1))
{
ExitLong("", "");
}
}
Thanks
Comment