Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Need help in developing Fractal Strategy
Collapse
X
-
Sounds like a straight out use for the Strategy Wizard. Open it up, and set the conditions. They both look like a simple price-cross over Plots.Originally posted by ssijbabu View Post
-
I developed a strategy for fixed stop loss and take profit (Strategy 2).Originally posted by koganam View PostSounds like a straight out use for the Strategy Wizard. Open it up, and set the conditions. They both look like a simple price-cross over Plots.
But for the first strategy, i dont know how to create the exit condition.
Please help me.
Regards,
Sujay
Comment
-
You said it yourself: you want to close at the end of the day. NT has a function called ExitOnClose. That seems to be what it means.Originally posted by ssijbabu View PostI developed a strategy for fixed stop loss and take profit (Strategy 2).
But for the first strategy, i dont know how to create the exit condition.
Please help me.
Regards,
Sujay
Add the directives to your Initialize() function. Here is the shell:
I do not think that you can add those from the Wizard, so you are going to have to unlock the code.Code:protected override void Initialize() { // Triggers the exit on close function 30 seconds prior to session end ExitOnClose = true; ExitOnCloseSeconds = 30; }
Comment
-
Hi Sujay,
The above will not be good for instruments that are open later than 4:15 PM. For example CL closes at 5:15 PM EST and TF closes at 6:00 PM EST and you want to get out before 4:15PM EST.
You could also use the time function to close your position before a major financial news release by using ToTime function
OR do not take a position until the news has released or Market has opened.if (ToTime(Time[0]) >= 92000 || ToTime(Time[0]) <= 925000)
{
ExitLong(); //Managed Orders
//ExitShort():
return;
}
if (ToTime(Time[0]) <= 93500)
{
return;
}Put these before your code in OnBarUpdate()//if (ToTime(Time[0]) <= 120000 || ToTime(Time[0]) >= 161300)
{
ExitLong();
return;
}
Comment
-
ExitOnClose doesn't always exit @ 4:15 EST, it exits at the end time specified in the session template you're using.Originally posted by mypkonline View PostHi Sujay,
The above will not be good for instruments that are open later than 4:15 PM. For example CL closes at 5:15 PM EST and TF closes at 6:00 PM EST and you want to get out before 4:15PM EST.
Comment
-
Agreed!
However, I use one strategy for 5 different instruments. It will not work for my if I want close all before 4:15PM EST.
Comment
-
The OP made a very specific request.Originally posted by mypkonline View PostHi Sujay,
The above will not be good for instruments that are open later than 4:15 PM. For example CL closes at 5:15 PM EST and TF closes at 6:00 PM EST and you want to get out before 4:15PM EST.
You could also use the time function to close your position before a major financial news release by using ToTime function
OR do not take a position until the news has released or Market has opened.
Put these before your code in OnBarUpdate()
There is no mention of 4:15 PM EDT or any other time. I responded to the request made; not made assumptions as to what was wanted. "End of the day", is "end of the day", not 4:15 PM.Code:Strategy 1: Enter: Enter long when the price cross upper line or short when the price cross lower line. [COLOR=Red][B]Exit:[/B] At the [B]end of the day[/B] (close price of the day).[/COLOR]
When I ask a client for requirements, or even if I answer for free, I expect precision in specification. Indeed, if the scope of work said "end of the day" and I coded that, and the client came back to say what you just said about different instruments closing at different times, I expect that the client would know that, and if he wanted code to close at a specific time regardless of instrument, then that is what the scope-of-work should have said. I would consider it a change in the scope of work, and it would be billable.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
648 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
369 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
572 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
574 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment