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
Sometimes Order Not Closign in Strategy Analyzer
Collapse
X
-
Hello, thanks for writing in. The order may be missed due to lack of intrabar grainularity. We have a guide and an example on implementing this here:
Also, add a print() method to make sure the order is actually submitted in the historical backtests.Chris L.NinjaTrader Customer Service
-
You don't mention what kind of order this is (limit? market? stop market? stop limit?) and in the screenshot these are renko bars which don't necessarily represent the prices that traded during that time period - there might also be an issue there that Strategy Analyzer is making more apparent.
Comment
-
Perhaps the order is being rejected because the price is already beyond the stopLong price. You could check if low <= stopLong and if so ExitLong() instead of placing an exit long stop market order. There are other possibilities, but given only these two lines of code that is what comes to mind.
Comment
-
ok.
Can you also advice on how i can make sure i wait 2 bars after recent take profit, stop loss or parabolic stop loss.. Am I doing it right?
For some reason. if i enter short with parabolic stop, parabolic stop hits, then another valid signal and on next bar i open order. I want to wait at least two bars.
&& (BarsSinceExitExecution("34B Short") > 1 || BarsSinceExitExecution("34B Short") == -1)
&& (BarsSinceExitExecution("34B Long") > 1 || BarsSinceExitExecution("34B Long") == -1)
EnterShort(PositionSize, "34B Short");
SetParabolicStop("34B Short", CalculationMode.Ticks, ParabolilcSarSL, false, 0.02, 0.2, 0.02);
Last edited by tkaboris; 06-29-2023, 08:29 AM.
Comment
-
HI i am adding AddDataSeries(Data.BarsPeriodType.Tick, 1);
for more accurate backtesting and following above example that was posted in #2Forum
So i added that tick data and my entry is
EnterLong(PositionSize, "StochFL");
if(stopLong <= bid){
ExitLongStopMarket(0, true, Position.Quantity, stopLong, "SLL", "StochFL");
ExitLongLimit(0, true, Position.Quantity, Position.AveragePrice + (TickSize * tpByATR), "PTL", "StochFL");
}
However I am still getting many orders that dont get TP or SL set in strategy analyzer... What else can i check?
Comment
-
ok i changed some of the entries
else if (State == State.Configure)
{
Calculate = Calculate.OnPriceChange;
AddDataSeries(Data.BarsPeriodType.Tick, 1);
}
TickReplay is enabled
if (UseParabolicStop){
SetParabolicStop("StochFS", CalculationMode.Ticks, ParabolilcSarSL, false, Acc, AccStep, AccMax);
}
EnterShort(PositionSize, "StochFS");
I still get this unfulifled stops in strategy analyzer
Also i understand that If i choose rather regular stoploss i need to change from 0 to 1.
if(stopShort >= ask){
ExitShortStopMarket(1, true, Position.Quantity, stopShort, "SLS", "StochFS");
ExitShortLimit(1, true, Position.Quantity, Position.AveragePrice - (TickSize * tpByATR), "PTS", "StochFS");
}
Comment
-
NinjaTrader_ChrisL I entered short with
if(ParabolilcSarSL >= ask){
SetParabolicStop("StochFS", CalculationMode.Ticks, ParabolilcSarSL, false, Acc, AccStep, AccMax);
EnterShort(PositionSize, "StochFS");
}
its strategy analyzer with tick data. Parabolic stop loss didnt trigger. My longs seem to work ok but short parabolic is not
Last edited by tkaboris; 07-06-2023, 08:21 AM.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ZeroKuhl, Today, 04:31 PM
|
0 responses
14 views
0 likes
|
Last Post
by ZeroKuhl
Today, 04:31 PM
|
||
Started by Vulgoth_t_Destroyer, 05-09-2022, 04:45 PM
|
54 responses
5,337 views
0 likes
|
Last Post
by Gaterz
Today, 04:29 PM
|
||
Started by ETFVoyageur, 05-07-2024, 07:05 PM
|
11 responses
76 views
0 likes
|
Last Post
by -=Edge=-
Today, 04:27 PM
|
||
Started by _Zero_, 04-10-2020, 03:21 PM
|
145 responses
7,900 views
6 likes
|
Last Post
by johng2
Today, 04:19 PM
|
||
Started by TheTradingMantis, 01-19-2023, 02:05 AM
|
43 responses
923 views
0 likes
|
Last Post
by jmagaia
Today, 04:13 PM
|
Comment