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 Jimmyk, 01-26-2018, 05:19 AM
|
6 responses
834 views
0 likes
|
Last Post
by emuns
Today, 11:27 AM
|
||
Started by jxs_xrj, 01-12-2020, 09:49 AM
|
6 responses
3,290 views
1 like
|
Last Post
by jgualdronc
Today, 10:56 AM
|
||
Started by Touch-Ups, Today, 10:36 AM
|
0 responses
9 views
0 likes
|
Last Post
by Touch-Ups
Today, 10:36 AM
|
||
Started by geddyisodin, 04-25-2024, 05:20 AM
|
11 responses
62 views
0 likes
|
Last Post Today, 10:08 AM | ||
Can someone turn this thinkscript into a ninjascript. 5PM CST OHL and Previous Day
by Option Whisperer
Started by Option Whisperer, Today, 09:55 AM
|
0 responses
8 views
0 likes
|
Last Post Today, 09:55 AM |
Comment