I used the script the Jrath edited and I have a new source of confusion.
If I change Lots from 1000 to 500, I expected the AR to be fixed. However, the sign on the AR changed from positive to negative. What is the impact of Lot Size on the enterLong/enterShort functions?
I'm guessing that has to be the source of the variance.
Do I need to define each of the parameters in order to get a the expected behavior of AR being fixed by only changing the Lots parameter?
function run()
{
Lots = 1000;
vars Close = series(priceClose());
vars SMA200 = series(SMA(Close,200));
vars SMA20 = series(SMA(Close,20));
vars Price_diff200 = series(abs((*Close - *SMA200)/ (*Close)) * 100.0);
if(*Price_diff200 > 2.0)
if(SMA20 < SMA200)
enterLong();
else if(SMA20 > SMA200)
enterShort();
}