Variable value set by output condition of IF - futures io
futures io



Variable value set by output condition of IF


Discussion in NinjaTrader

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

Variable value set by output condition of IF

(login for full post details)
  #1 (permalink)
 b16aln 
London
 
Experience: None
Platform: ninjatrader
Trading: ftse100
 
Posts: 59 since Sep 2017
Thanks: 10 given, 14 received

Hello,

Does anyone here know how to set a variable value based on the output of an IF statement so that my variable value is dependent on the IF outcome?

I tried the code below but I am not getting any value outputs for varA1

double varA1:

if(condition)
{varA1 = value1}
else
{varA1 = value2}

Many thanks in advance

Started this thread Reply With Quote

Journal Challenge April 2021 results (now extended!):
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(79 thanks from 10 posts)
looks_twoSalao's Journalby Salao
(23 thanks from 5 posts)
looks_3Deetee’s DAX Trading Journal (time based)by Deetee
(15 thanks from 8 posts)
looks_4Learning to Profit - A journey in algorithms and optionsby Syntax
(12 thanks from 7 posts)
looks_5Rogue MNQ 2/21 Journeyby RogueJoules
(0 thanks from 2 posts)
 
Best Threads (Most Thanked)
in the last 7 days on futures io
The Crude Dude Oil Trading System
73 thanks
futures io site changelog and issues/problem reporting
71 thanks
Would You Sell Your System?
65 thanks
FIO Journal Challenge - April 2021 w/Jigsaw Trading
30 thanks
Big Mike in Ecuador
25 thanks
 
(login for full post details)
  #3 (permalink)
 xplorer 
Site Moderator
London UK
 
Experience: Beginner
Platform: CQG
Broker: S5
Trading: Futures
 
xplorer's Avatar
 
Posts: 5,346 since Sep 2015
Thanks: 13,470 given, 12,921 received



b16aln View Post
Hello,

Does anyone here know how to set a variable value based on the output of an IF statement so that my variable value is dependent on the IF outcome?

I tried the code below but I am not getting any value outputs for varA1

double varA1:

if(condition)
{varA1 = value1}
else
{varA1 = value2}

Many thanks in advance

You can download and open most code available in the Downloads section and see for yourself.


For example, this snippet works

 
Code
					if (L0 >= A)       
					{ 
						deltaM =   tv;	
					} 
					
				   	if (L0 <= B)       
					{ 
						deltaM =  -tv;	
					}


It's probably a matter of using the right syntax.

Reply With Quote
 
(login for full post details)
  #4 (permalink)
 b16aln 
London
 
Experience: None
Platform: ninjatrader
Trading: ftse100
 
Posts: 59 since Sep 2017
Thanks: 10 given, 14 received

Thanks, got it. My IF statement logic was wrong....

Started this thread Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Variable value set by output condition of IF


Last Updated on July 25, 2019


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1,800 in prizes!

April
 

Seven Trading Mistakes Solved With Smart Trading Tools w/Brannigan Barrett

Elite only
     



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