Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Position not being closed in strategy analyzer
Collapse
X
-
Hello tkaboris,
Looking at the code wouldn't tell me if the price crossed above the working price of the order.
The code doesn't have the bar high low information of each bar, the code doesn't show at what price the parabolic stop order is working at.
So for diagnosing an issue, only the output from prints and traceorders are going to show what happened.
From the print output we can see the strategy submitted the order and we can see that it is working and the price it is working at.
We just need to see the bar price to verify this rose above 15250.
Previously these prints were in the output. Did you remove this print?
The amount of prints would be due to using a set method which is updated with every bar update. When using Calculate.OnEachTick or .OnPriceChange instead of .OnBarClose there will be several prints for each bar.
If the price rising happens further back than what can be shown in the output window, it might be necessary to write to file instead of printing, but I'd like to look and confirm first.
Right now, it looks like after the parabolic stop order is submitted the market price never goes up to 15250 and the parabolic stop may be too far away.Chelsea B.NinjaTrader Customer Service
Comment
-
Hello tkaboris,
The order is working at 15250 by the end of output so the price would have to come up to that.
Perhaps you are placing the parabolic stop with too great of a distance in ticks.
All set methods are updated on every bar. This is how the parabolic stop is able to trail following the parabolic logic.Chelsea B.NinjaTrader Customer Service
Comment
-
Hello tkaboris,
To confirm, you are only calling SetParabolicStop once before the entry is submitted as advised in post # 8?
Please provide the script with that code.
Currently, in the file from your post # 28, this appears to be re-submitting SetParabolicStop after the entry and on every bar, resetting it to the current price on each new bar.Chelsea B.NinjaTrader Customer Service
Comment
-
Hi Yes
Here is my entry for shorts and I am not seting parabolic anywhere else for shorts only for longs
if (UseParabolicStop){
SetParabolicStop("StochFS", CalculationMode.Ticks, ParabolilcSarSL, false, Acc, AccStep, AccMax);
}
EnterShort(PositionSize, "StochFS");
if (UseParabolicStop){
SetParabolicStop("StochFL", CalculationMode.Ticks, ParabolilcSarSL, false, Acc, AccStep, AccMax);
}
EnterLong(PositionSize, "StochFL");
Comment
-
Hello tkaboris,
This appears to be nested in a condition that looks for the position to be long, meaning this would be submitted after the entry and not before.
if (Position.MarketPosition == MarketPosition.Long && myFreeTradeLong == true || StochSwingLong == true)
Have you added prints to confirm this line of code is only being called before the entry is called?
I don't mean that it's above it in the code, I am talking about the sequence of actions.
If the position is already long, then you would be calling this after the entry was submitted and filled.
Further, what is stopping this from being called on every bar?
Have you added a print to confirm this code is being called once before the entry is placed and is not being called again after the entry has been submitted?Chelsea B.NinjaTrader Customer Service
Comment
-
I tried commenting out the whole region of for shorts and becacuse I dont need it since I place setparabolicstop before the entry order. But it still gives out same results, cant close short orders.
if (Position.MarketPosition == MarketPosition.Short && myFreeTradeShort == true || StochSwingShort == true)
I dont know how to confirm this ..
Have you added a print to confirm this code is being called once before the entry is placed and is not being called again after the entry has been submitted?
Comment
-
Hello tkaboris,
I have suggested that you call set methods before calling the entry and not in a separate condition set. Have you attempted this?
if (Position.MarketPosition == MarketPosition.Flat)
{
SetParabolicStop("StochFL", CalculationMode.Ticks, ParabolilcSarSL, false, Acc, AccStep, AccMax);
EnterLong(PositionSize, "StochFL");
}Chelsea B.NinjaTrader Customer Service
Comment
-
hi yes i did all that and tried other combinations.
I wanted to take your provided example for setparabolic stop example and see if it runs correctly in strategy analyzer but its not working for me in analyzer even thought it gets enabled in real time.
I think there is an issue with setparabolicstop running in strategy analyzer when running both longs and shorts
Comment
-
Hello tkaboris,
Which example?
Are you referring to the code sample from the help guide that is placed in State.Configure?
https://ninjatrader.com/support/help...abolicstop.htm
Are you referring to this example from Brandon?
https://forum.ninjatrader.com/forum/...11#post1236111
I will test on my end and let you know what I find. I appreciate your patience.I think there is an issue with setparabolicstop running in strategy analyzer when running both longs and shortsChelsea B.NinjaTrader Customer Service
Comment
-
I was referring to the one by brandon...
Are you referring to this example from Brandon?
https://forum.ninjatrader.com/forum/...11#post1236111
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, Yesterday, 05:17 AM
|
0 responses
56 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
132 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
73 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
45 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
49 views
0 likes
|
Last Post
|

Comment