I'm wondering if someone can give me an idea of how to capture the Close[0] when a condition is met and then record that data for future use? Thanks
Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Getting Close[0] when conditions met
Collapse
X
-
Getting Close[0] when conditions met
Hello,
I'm wondering if someone can give me an idea of how to capture the Close[0] when a condition is met and then record that data for future use? ThanksTags: None
-
-
Originally posted by CaptainAmericaXX View PostHello,
I'm wondering if someone can give me an idea of how to capture the Close[0] when a condition is met and then record that data for future use? ThanksCode:private double CaptainAmericaMegaBucksPrice = -1;
Code:if (ConditionMet && CaptainAmericaMegaBucksPrice < 0) { CaptainAmericaMegaBucksPrice = Close[0]; } MakeMegaBucks(CaptainAmericaMegaBucksPrice, ...); if (PositionHasBeenClosed || WeNeedToReset) { CaptainAmericaMegaBucksPrice = -1; //or whatever the initial unset value is supposed to be. }
Comment
-
koganam, you're awesome! I swear if I ever start making money trading I'm going to send you a check!
I tried to follow your advice. I'm ok at plugging what others give me, but not very good at figuring it out myself. Here is what I have so far:
Code:private double closeprice = -1;
Code:if (CrossAbove(RSMarketDirection(12).UpTrend, RSMarketDirection(12).SMALine, 1) && vcloseprice < 0) { closeprice = Close[0]; } MakeMegaBucks(closeprice); if (PositionHasBeenClosed || WeNeedToReset) { closeprice = -1; }
Comment
-
Originally posted by CaptainAmericaXX View Postkoganam, you're awesome! I swear if I ever start making money trading I'm going to send you a check!
I tried to follow your advice. I'm ok at plugging what others give me, but not very good at figuring it out myself. Here is what I have so far:
Code:private double closeprice = -1;
Code:if (CrossAbove(RSMarketDirection(12).UpTrend, RSMarketDirection(12).SMALine, 1) && vcloseprice < 0) { closeprice = Close[0];[COLOR=blue] //good enough[/COLOR] } MakeMegaBucks(closeprice); [COLOR=blue]//this just represents all the stuff that you want to do with the information that you have captured above. It was just a placeholder.[/COLOR] if (PositionHasBeenClosed || WeNeedToReset) [COLOR=blue]//this is just a description of when you want to reset your variable, so that you do not have unintended side effects.[/COLOR] { closeprice = -1; }
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by aligator, 01-06-2022, 12:14 PM
|
4 responses
233 views
0 likes
|
Last Post
by john_44573
Today, 06:11 PM
|
||
Started by reynoldsn, Today, 05:56 PM
|
0 responses
4 views
0 likes
|
Last Post
by reynoldsn
Today, 05:56 PM
|
||
Started by bortz, 11-06-2023, 08:04 AM
|
51 responses
1,989 views
0 likes
|
Last Post
by aligator
Today, 05:50 PM
|
||
Started by dmking, 11-12-2019, 12:31 PM
|
4 responses
4,150 views
0 likes
|
Last Post
by jasonw
Today, 04:32 PM
|
||
Started by roblogic, Today, 04:31 PM
|
0 responses
10 views
0 likes
|
Last Post
by roblogic
Today, 04:31 PM
|
Comment