Need help with TOS Script - futures io
futures io



Need help with TOS Script


Discussion in ThinkOrSwim

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




Welcome to futures io: the largest futures trading community on the planet, with well over 150,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
 

Need help with TOS Script

(login for full post details)
  #1 (permalink)
vicosobase
Detroit MI
 
 
Posts: 1 since Dec 2016
Thanks: 1 given, 0 received

Please, can anyone help with this (ThinkOrSwim)? I am trying to display "BULLISH DAY" or "BEARISH DAY" based on whether the main PIVOT LINE is below or above the Previous Day Close.

That is if Main Pivot Line is above Previous Day Close, Display BEARISH and if Main Pivot Line is below Previous Day Close, Display BULLISH.

I have the below code but I am NOT skilled enough to make do the above. The attachment shows what the below code is showing, which is not what I want.

input aggregationPeriod = AggregationPeriod.DAY;

def PreDayClose = close(period = aggregationPeriod)[1];
def PH = high(period = aggregationPeriod)[1];
def PL = low(period = aggregationPeriod)[1];
def PC = close(period = aggregationPeriod)[1];

plot close = PreDayClose;
def PP = (PH + PL + PC) / 3;

def BULL = PP < PreDayClose;
def BEAR = PP > PreDayClose;

AddLabel(yes, "BULLISH =" + BULL, Color.GREEN);
AddLabel(yes, "BEARISH =" + BEAR, Color.YELLOW);

Reply With Quote

Can you help answer these questions
from other members on futures io?
use of Ultimate Oscillator in NT8
NinjaTrader
NT8 - Footprint Chart adding on code
NinjaTrader
NT deleting my Strategies on charts
NinjaTrader
Moving Average Price Scan
ThinkOrSwim
TOS Fold Loop to NT8 For Loop
NinjaTrader
 
 
(login for full post details)
  #2 (permalink)
ColoradoCliff
Parker CO/USA
 
 
Posts: 8 since Jun 2017
Thanks: 0 given, 2 received

Well, there's a lot going on in your code that doesn't make a ton of sense to me, and there's no attachment so I can't see what you're seeing on your charts.

First, are you wanting to calculate the pivot based on the previous day's price action, or the current day's action? If it's the current day's price pivot, get rid of all the [1] subscripts when calculating the Pivot

Secondly, you're always going to show both the BULLISH & BEARISH labels, why not just show the label that matches the condition you care about?

Thirdly, it's not clear what timeframe charts you will typically use this -- I'm assuming an Intraday rather than Daily/Weekly.

I've changed a few things and added some additional AddLabels to help with diagnosing the code (comment or delete the extra AddLabel statements when you get what you want.

input aggregationPeriod = AggregationPeriod.DAY;

def PreDayClose = close(period = aggregationPeriod)[1];
def PH = high(period = aggregationPeriod)[1];
def PL = low(period = aggregationPeriod)[1];
def PC = close(period = aggregationPeriod)[1];

def PP = (PH + PL + PC) / 3;

def BULL = PP < PreDayClose;
def BEAR = PP > PreDayClose;

plot myClose = PreDayClose;
plot myPivot = PP;

AddLabel(yes,"PH/PL/PC= " + PH + " / " + PL + " / " + PC);


AddLabel(BULL, "BULLISH", Color.GREEN);
AddLabel(BEAR, "BEARISH", Color.YELLOW);



vicosobase View Post
Please, can anyone help with this (ThinkOrSwim)? I am trying to display "BULLISH DAY" or "BEARISH DAY" based on whether the main PIVOT LINE is below or above the Previous Day Close.

That is if Main Pivot Line is above Previous Day Close, Display BEARISH and if Main Pivot Line is below Previous Day Close, Display BULLISH.

I have the below code but I am NOT skilled enough to make do the above. The attachment shows what the below code is showing, which is not what I want.

input aggregationPeriod = AggregationPeriod.DAY;

def PreDayClose = close(period = aggregationPeriod)[1];
def PH = high(period = aggregationPeriod)[1];
def PL = low(period = aggregationPeriod)[1];
def PC = close(period = aggregationPeriod)[1];

plot close = PreDayClose;
def PP = (PH + PL + PC) / 3;

def BULL = PP < PreDayClose;
def BEAR = PP > PreDayClose;

AddLabel(yes, "BULLISH =" + BULL, Color.GREEN);
AddLabel(yes, "BEARISH =" + BEAR, Color.YELLOW);


Reply With Quote
The following user says Thank You to ColoradoCliff for this post:


futures io Trading Community Platforms and Indicators ThinkOrSwim > Need help with TOS Script


Last Updated on June 19, 2022


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2022 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), 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