Help - Trade Ribbon - futures io
futures io futures trading



Help - Trade Ribbon


Discussion in ThinkOrSwim

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




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Help - Trade Ribbon

(login for full post details)
  #1 (permalink)
Troy, Michigan, US
 
 
Posts: 3 since Mar 2018
Thanks: 0 given, 0 received

Moved thread to proper location

Good morning/afternoon/evening fellow members,

I'm having a bit of trouble with a script.

So what it's supposed to do is:
When there is a uptrend all candles above the 8 EMA should be green
When there is a downtrend all candles below the 21 EMA should be red
When price action is in between the 8/21 EMA candles should be yellow

For some reason I'm getting white and yellow and the signals are coming when the EMA's cross, rather than the price action falling into the EMA's. Any help would be greatly appreciated, the script is posted below.

NOTE: In regards to the yellow and white, there is a line near the bottom of the code else if color.white
But, when I try to remove it, I get syntax error at the first if.

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


futures io Trading Community Platforms and Indicators ThinkOrSwim > Help - Trade Ribbon


Last Updated on September 8, 2018


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Call Option Buying: The New Pain Trade? w/Carley Garner

Elite only
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

New Challenge (TBD)

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts