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 algospoke, 04-17-2024, 06:40 PM
|
6 responses
49 views
0 likes
|
Last Post
by algospoke
Today, 06:18 PM
|
||
Started by arvidvanstaey, Today, 02:19 PM
|
4 responses
11 views
0 likes
|
Last Post Today, 04:08 PM | ||
Started by samish18, 04-17-2024, 08:57 AM
|
16 responses
61 views
0 likes
|
Last Post
by samish18
Today, 03:30 PM
|
||
Started by jordanq2, Today, 03:10 PM
|
2 responses
9 views
0 likes
|
Last Post
by jordanq2
Today, 03:23 PM
|
||
Started by traderqz, Today, 12:06 AM
|
10 responses
21 views
0 likes
|
Last Post
by traderqz
Today, 02:49 PM
|
Comment