Mocnarf1
Member
Check this out. It's simple and straight forward. I use a 15 minute candle.
Let me know how it compares with other strategies:
Let me know how it compares with other strategies:
Code:
####### My Buy Alert Study #######
#### MyBuyAlert() is true; ####
plot condition =
(MovingAvgCrossover("length1" = 21, "length2" = 42, "crossing type" = "below") is true
and TrendPeriods() is true
and open < SimpleMovingAvg("length" = 9)."SMA"[0]
and open > SimpleMovingAvg("length" = 200)."SMA"[0])
or
MovingAvgCrossover("length1" = 9, "length2" = 200, "crossing type" = "above") is true
;
######## My Sell Alert Study #########
#### MySellAlert() is true; ####
plot condition =
(MovingAvgCrossover("length1" = 21, "length2" = 42,"crossing type" = "Above") is true
and open > SimpleMovingAvg("length" = 9)."SMA"[0])
or
MovingAvgCrossover("length1" = 9, "length2" = 200,"crossing type" = "below") is true
;
#########################################
######## MyBuySellAlert Strategy ##########
def buy =
(MovingAvgCrossover("length1" = 21, "length2" = 42, "crossing type" = "below") is true
and TrendPeriods() is true
and open < SimpleMovingAvg("length" = 9)."SMA"[0]
and open > SimpleMovingAvg("length" = 200)."SMA"[0])
or
MovingAvgCrossover("length1" = 9, "length2" = 200, "crossing type" = "above") is true
;
def sell =
(MovingAvgCrossover("length1" = 21, "length2" = 42,"crossing type" = "Above") is true
and open > SimpleMovingAvg("length" = 9)."SMA"[0])
or
MovingAvgCrossover("length1" = 9, "length2" = 200,"crossing type" = "below") is true
;
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);
Last edited by a moderator: