convert variable to constant - futures io
futures io futures trading



convert variable to constant


Discussion in ThinkOrSwim

Updated
    1. trending_up 2,033 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 2 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
 

convert variable to constant

(login for full post details)
  #1 (permalink)
Dallas Tx/USA
 
 
Posts: 2 since Jul 2012
Thanks: 0 given, 0 received

how can i convert the close for today to a constant value that I can use in other calculations? I don't want to use code like x = close() because then x would vary each day.

Reply With Quote

Can you help answer these questions
from other members on futures io?
Neurological explanations for trading Success
Psychology and Money Management
Automatic pattern research with NT
Elite Algorithmic NinjaTrader Trading
Which kind of Blockvolume is visible? - order processing
Emini and Emicro Index
Webinar: Finding your own way in trading w/Adam Grimes
The Elite Circle
Volume Profile Indicator for Ninja Script in NT8
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Battlestations: Show us your trading desks!
137 thanks
Big Mike in Ecuador
34 thanks
Want your NinjaTrader indicator created, free?
32 thanks
Saturday Morning Market Replay!
20 thanks
Selling Options on Futures?
19 thanks
 
(login for full post details)
  #2 (permalink)
Singapore
 
Experience: Beginner
Platform: ThinkOrSwim, NinjaTrader
Trading: options, currency
 
Posts: 13 since Apr 2011
Thanks: 23 given, 12 received

@TrickyDick

You can try the following. It is assigned to the first Close bar.

 
Code
double todayClose = 0; // initialized in OnStartup() 

// In OnBarUpdate()
if( todayClose == 0 )
   todayClose = Close[0];  // Assigned once only

Reply With Quote
 
(login for full post details)
  #3 (permalink)
Dallas Tx/USA
 
 
Posts: 2 since Jul 2012
Thanks: 0 given, 0 received


Thank you for responding, but I don't understand your answer for two reasons.
I pasted your code into a new ThinkOrSwim study, and the study rejected almost every line.
(1) TOS doesn't accept the word double. I tried double.NAN and other things but TOS still doesn't accept it.
(2) I think you're using '//' as a remark, but TOS requires '#' to show remarks
I changed '//' to '#' but then the script was still rejected because of (1) is an invalid statement

Would you please provide more information.
Thank you.

Reply With Quote


futures io Trading Community Platforms and Indicators ThinkOrSwim > convert variable to constant


Last Updated on October 30, 2014


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

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

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

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