NexusFi: Find Your Edge


Home Menu

 





Help - Trade Ribbon


Discussion in ThinkOrSwim

Updated
    1. trending_up 721 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 0 posts
    2. attach_file 0 attachments




 
Search this Thread

Help - Trade Ribbon

  #1 (permalink)
sjlarowe
Troy, Michigan, US
 
Posts: 3 since Mar 2018
Thanks Given: 0
Thanks Received: 0

input price = close ;
input length = 11;
def EMA8 = ExpAverage (close, 8);
def EMA13 = ExpAverage (close, 13);
def EMA21 = ExpAverage (close, 21);
def EMArange = (price[1] between EMA8 and EMA21) or (price[1] between ema21 and ema8);

def buy = ema8 > ema13 and ema13 > ema21 and low > ema8;
def stopbuy = ema8 <= ema13;
def buynow =!buy[1] and buy;

def buysignal = compoundvalue (1, if buynow and !stopbuy then 1 else if buysignal[1]==1 and stopbuy then 0 else buysignal [1],0);
def buy_signal = buysignal[1] == 0 and buysignal ==1;

def sell = ema8 < ema13 and ema13 < ema21 and high < ema8;
def stopsell = ema8 >= ema13;
def sellnow = !sell[1] and sell;
def sellsignal = compoundvalue (1, if sellnow and !stopsell then 1 else if sellsignal[1]==1 and stopsell then 0 else sellsignal [1],0);
def sell_signal = sellsignal[1] == 0 and sellsignal;


AssignPriceColor
(if sell_signal or (sellsignal && !emarange) then Color.red
else if buy_signal or( buysignal && !emarange ) then Color.green

else if EmArange then color.yellow




else Color.white);

AddOrder(OrderType.BUY_AUTO, buy_signal, close[-1], 100, Color.YELLOW, Color.YELLOW, "buy");
AddOrder(OrderType.SELL_AUTO, sell_signal, close[-1], 100, Color.RED, Color.RED, "sell")

Reply With Quote




Last Updated on September 8, 2018


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts