|
Kiran
2016-04-13 13:38:00
0
|
|
I have a simple timing script on 1 symbol (SPY) that Buys when Price>SMA, Sells 10 days later.
It doesn't seem to execute the barssince(buy)>10; correctly, because the Trades tab shows positions are held for 4-6 weeks (variable time periods).
- why isn't the barssince(buy)>10 work correctly in this scenario?
/// script
Optimize("fastper", 5,75,10);
Optimize("slowper", 50,200,25);
Optimize("holdper",10,30,10);
Buy = (Close > SMA(Close,fastper) && Close > SMA(Close,slowper));
Sell = barssince(buy)>holdper;
//Sell = (Close < SMA(Close,fastper) || Close < SMA(Close,slowper)) && barssince(buy)>holdper;
|
|