Mocnarf1
Member
I have a study based Conditional Order that fails to trigger when I can see on the chart that it should have triggered.
What would cause the problem?
Here's details:
[image] [/image]
MyBuySell_Trend_Strategy
MyBuy_Trend Study
MySell_Trend Study
What would cause the problem?
Here's details:
[image] [/image]
MyBuySell_Trend_Strategy
Code:
def buy =
open < SimpleMovingAvg("length" = 81)."SMA"[0]
and TrendPeriods("fast length" = 21, "slow length" = 42) [0] < 0
and TrendPeriods("fast length" = 21, "slow length" = 42)[3] < 0
and TrendPeriods("fast length" = 21, "slow length" = 42)[4] > 0
;
def sell =
TrendPeriods("fast length" = 21, "slow length" = 42) > 0
and TrendPeriods("fast length" = 21, "slow length" = 42)[13] > 0
and TrendPeriods("fast length" = 21, "slow length" = 42)[14] < 0
;
def buysignal = buy;
def sellsignal = sell;
AddOrder(OrderType.BUY_TO_OPEN, buysignal, name = "Buy", tickcolor = Color.DARK_RED, arrowcolor = Color.RED);
AddOrder(OrderType.SELL_TO_CLOSE, sellsignal, name = "Sell", tickcolor = Color.GREEN, arrowcolor = Color.GREEN);
MyBuy_Trend Study
Code:
plot condition =
open < SimpleMovingAvg("length" = 81)."SMA"[0]
and TrendPeriods("fast length" = 21, "slow length" = 42) [0] < 0
and TrendPeriods("fast length" = 21, "slow length" = 42)[3] < 0
and TrendPeriods("fast length" = 21, "slow length" = 42)[4] > 0
;
Code:
plot condition =
TrendPeriods("fast length" = 21, "slow length" = 42) > 0
and TrendPeriods("fast length" = 21, "slow length" = 42) from 13 bars ago > 0
and TrendPeriods("fast length" = 21, "slow length" = 42) from 14 bars ago < 0
;