Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Exit at price instead of when bar close
Collapse
X
-
Hello babouin77,
Thank you for your reply.
Please note that we do not offer debugging services in the support department and taking the debugging steps and checking the strategy logic is the responsibility of the developer of the strategy. In this case, you would be responsible for taking these steps and checking if your logic works as you expect.
Please follow up if you have additional questions after you have debugged the strategy using prints like we have suggested. This would be done so you can check the logic your strategy logic and see why your conditions are not allowing actions to be taken.
We also would ask that you refrain from making additional posts to the thread until you have thoroughly tested what you can on your end. This helps others reading the thread so it is easier to follow, and also helps our support technicians so they can pick up the thread in another tech's absence.
Please let us know if we may be of further assistance to you.Kate W.NinjaTrader Customer Service
Comment
-
Hello babouin77,
IsFirstTickOfBar will always be true unless a script is using Calculate.OnEachTick or Calculate.OnPriceChange and that script is processing historical data with Tick Replay enabled or the script is processing realtime data. When we are processing historical data with Tick Replay or processing realtime data when the script uses Calculate.OnEachTick or Calculate.OnPriceChange, IsFirstTickOfBar will only be true when we are processing the first tick of a bar.
Here is a demonstration showing how you can test IsFirstTickOfBar and understand how it is used. I recommend setting up small test scripts like this to better understand the properties you want to use.
Demo - https://drive.google.com/file/d/1Laz...w?usp=drivesdk
Your script is also not following our suggestion for a useful debugging print. You need to print the values used to evaluate your conditions above the condition, not within that condition. Printing out values inside the condition only tells you it became true. Printing out the values used to evaluate that condition outside of that condition will tell you what each value is, before the condition is checked, so you can understand why it is not becoming true.
In order to understand why an order is not being submitted, or in general why any strategy has not taken an expected action, you need to use prints to:
1. Confirm the order submission method is reached (Place a print next to the order method in the came code block)
2. If the order method is not reached, you need to debug the condition controlling it (Place a print above the condition that prints the values used in that condition.)
3. If the order method is reached, but no order is submitted, you will need to test again with TraceOrders enabled and check the order feedback in the NinjaScript Output window to see why the order was ignored.
Please let us know if this process is not clear.
JimNinjaTrader Customer Service
Comment
-
thanks a lot for your helpful video and explanation.
my script is using Calculate.OnEachTick and I am doing it in real time but it is not opening any trades with is first tick of bar... if I change to on bar close and remove is first tick it will open trades normally.
I changed my conditions
protected override void OnBarUpdate()
{
// Condition set 1 - Upward Price Breakout
Print("PriceBreakoutRectangularBase(upwardBreakout ,VolumeMultiple).Plot0[0] = " + PriceBreakoutRectangularBase(upwardBreakout,Volume Multiple).Plot0[0]);
Print("Market Position: " + Position.MarketPosition);
Print("IsFirstTickOfBar: " + IsFirstTickOfBar);
if (PriceBreakoutRectangularBase(upwardBreakout,Volum eMultiple).Plot0[0] == 1 && IsFirstTickOfBar )
// Position.MarketPosition == MarketPosition.Flat && IsFirstTickOfBar )
{
EnterLong(Convert.ToInt32(NumberOfContract), "Long");
justEntered = true;
}
i will test and let you know and I will make sure to choose on each tick and see if it will open any trades.
wil llet u know.
Comment
-
and even when it does not open any trades... if I turn off the strategy then on again i can see historical trades but in real time they never opened. in the screen shot below i have one chart on each tick and one chart on bar close 2 separate scripts and the on bar close opened a trade and on each tick did not open a trade.
Comment
-
Hello babouin77,
Thank you for your reply.
Originally posted by babouin77 View Postand even when it does not open any trades... if I turn off the strategy then on again i can see historical trades but in real time they never opened. in the screen shot below i have one chart on each tick and one chart on bar close 2 separate scripts and the on bar close opened a trade and on each tick did not open a trade.
In order to determine why a strategy has not taken expected actions, you will need to use debugging prints to understand if the conditions did not allow the order submission to be reached or if the conditions became true and the order was ignored. Please see our reply from post #34.
If you are finding it is too difficult for you to debug your logic, you could consider hiring a consultant to build a strategy the way you would like. Please let me know if you'd like a representative of our Vendor Support team to provide you with further information regarding NinjaScript Consultants.
Thanks in advance; I look forward to assisting you further.Kate W.NinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by knowmad, Today, 03:52 AM
|
2 responses
26 views
0 likes
|
Last Post
by knowmad
Today, 09:03 PM
|
||
Started by ETFVoyageur, Today, 07:05 PM
|
0 responses
7 views
0 likes
|
Last Post
by ETFVoyageur
Today, 07:05 PM
|
||
Started by Orion815, 05-02-2024, 08:39 AM
|
2 responses
18 views
0 likes
|
Last Post
by Orion815
Today, 06:24 PM
|
||
Started by suroot, 02-25-2017, 04:43 AM
|
11 responses
2,552 views
0 likes
|
Last Post
by Zilvercat
Today, 05:36 PM
|
||
Started by Rogers101, 05-05-2024, 11:30 AM
|
16 responses
50 views
0 likes
|
Last Post
by Rogers101
Today, 04:44 PM
|
Comment