NexusFi: Find Your Edge


Home Menu

 





Variable value set by output condition of IF


Discussion in NinjaTrader

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




 
Search this Thread

Variable value set by output condition of IF

  #1 (permalink)
 b16aln 
London
 
Experience: None
Platform: ninjatrader
Trading: ftse100
Posts: 67 since Sep 2017
Thanks Given: 11
Thanks Received: 23

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

Can you help answer these questions
from other members on NexusFi?
How to apply profiles
Traders Hideout
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
REcommedations for programming help
Sierra Chart
MC PL editor upgrade
MultiCharts
 
  #3 (permalink)
 
xplorer's Avatar
 xplorer 
London UK
Site Moderator
 
Experience: Beginner
Platform: CQG
Broker: S5
Trading: Futures
Posts: 5,981 since Sep 2015
Thanks Given: 15,508
Thanks Received: 15,428



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
  #4 (permalink)
 b16aln 
London
 
Experience: None
Platform: ninjatrader
Trading: ftse100
Posts: 67 since Sep 2017
Thanks Given: 11
Thanks Received: 23

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

Started this thread Reply With Quote




Last Updated on July 25, 2019


© 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