p.s. let's use code provided from #29 message for future references
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
after compile a new strategy, it doesn't appear as available!
Collapse
X
-
Hello Anquirk,
If no orders are submitted, this would imply the condition to submit the order did not evaluate as true, or the order was submitted and ignored or automatically cancelled.
To understand why you will need to debug using prints and TraceOrders as directed in post # 22.
Please provide the print and TraceOrders output text file and I will be happy to assist in analyzing the output and understanding why no orders were submitted or filled.Chelsea B.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_ChelseaB View PostHello Anquirk,
If no orders are submitted, this would imply the condition to submit the order did not evaluate as true, or the order was submitted and ignored or automatically cancelled.
To understand why you will need to debug using prints and TraceOrders as directed in post # 22.
Please provide the print and TraceOrders output text file and I will be happy to assist in analyzing the output and understanding why no orders were submitted or filled.
Seems like the hardiest part of that is upload any files due to restriction of NT forum.
Here is output link below. Can't upload file itself due to size restriction and extension restriction. So please follow the link to my google drive if it not against NT security policy https://drive.google.com/file/d/153k...ew?usp=sharing
Comment
-
Hello Anquirk,
It's good you are adding prints. Please also enable TraceOrders.
We are looking for a specific bar and time where you are expecting an order. Start the print with the Time[0] so we can know which bar is updating.
The print should show every value and how they are being compared.
For the condition:
if (!tradeExecutedToday && sessionHigh != double.MinValue && Closes[0][0] > sessionHigh)
Print(string.Format("{0} | !tradeExecutedToday: {1} && sessionHigh: {2} != double.MinValue: {3} && Closes[0][0]: {4} > sessionHigh: {2}", Time[0], !tradeExecutedToday, sessionHigh, double.MinValue, Closes[0][0]));Chelsea B.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_ChelseaB View PostHello Anquirk,
It's good you are adding prints. Please also enable TraceOrders.
We are looking for a specific bar and time where you are expecting an order. Start the print with the Time[0] so we can know which bar is updating.
The print should show every value and how they are being compared.
For the condition:
The print would appear as:
Comment
-
Hello Anquirk,
Starting at the top of the file
1/3/2021 6:15:00 PM | !tradeExecutedToday: True && sessionHigh: 3892 != double.MinValue: -1.79769313486232E+308 && Closes[0][0]: 3887.5 > sessionHigh: 3892
I'm seeing 3887.5 is not greater than 3892.
At a glance, i'm not seeing the close is ever greater than the high (as that would make a new high and they would be equal).Chelsea B.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_ChelseaB View PostHello Anquirk,
Starting at the top of the file
1/3/2021 6:15:00 PM | !tradeExecutedToday: True && sessionHigh: 3892 != double.MinValue: -1.79769313486232E+308 && Closes[0][0]: 3887.5 > sessionHigh: 3892
I'm seeing 3887.5 is not greater than 3892.
At a glance, i'm not seeing the close is ever greater than the high (as that would make a new high and they would be equal).
Comment
-
Hello Anquirk,
I'm not sure I understand, you are finding the highest high, including the current bar, and checking if the close is greater than the high?
The high is the highest close price reached while the bar was open. The close can be equal to the high but cannot be greater. If the close rises past the current bars high, that price becomes the new high so they would be equal.
I'm not quite following your logic.Chelsea B.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_ChelseaB View PostHello Anquirk,
I'm not sure I understand, you are finding the highest high, including the current bar, and checking if the close is greater than the high?
The high is the highest close price reached while the bar was open. The close can be equal to the high but cannot be greater. If the close rises past the current bars high, that price becomes the new high so they would be equal.
I'm not quite following your logic.
I am looking for the highest high during the time from 16:00 of the previous day to 9:30 of the current day (let's call it a night session for convenience). Then during the time from 9:30 to 16:00 of the current day (let's call it a daytime session) I want to execute a trade if the price goes above the overnight high.
Comment
-
Hello Anquirk,
I may still not be following.
You are setting sessionHigh to double.MinValue at 93000, at which it will remain until 160000, but you are checking the sessionHigh to not be equal to double.MinValue in the condition.
I was assuming this was to limit the condition to only being true from 160000 to 93000.
1/5/2021 9:30:00 AM | !tradeExecutedToday: True && sessionHigh: -1.79769313486232E+308 != double.MinValue: -1.79769313486232E+308 && Closes[0][0]: 3822 > sessionHigh: -1.79769313486232E+308
1/5/2021 9:45:00 AM | !tradeExecutedToday: True && sessionHigh: -1.79769313486232E+308 != double.MinValue: -1.79769313486232E+308 && Closes[0][0]: 3845 > sessionHigh: -1.79769313486232E+308
Where you wanting to set sessionHigh to double.MaxValue at 160000?Chelsea B.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_ChelseaB View PostHello Anquirk,
I may still not be following.
You are setting sessionHigh to double.MinValue at 93000, at which it will remain until 160000, but you are checking the sessionHigh to not be equal to double.MinValue in the condition.
I was assuming this was to limit the condition to only being true from 160000 to 93000.
1/5/2021 9:30:00 AM | !tradeExecutedToday: True && sessionHigh: -1.79769313486232E+308 != double.MinValue: -1.79769313486232E+308 && Closes[0][0]: 3822 > sessionHigh: -1.79769313486232E+308
1/5/2021 9:45:00 AM | !tradeExecutedToday: True && sessionHigh: -1.79769313486232E+308 != double.MinValue: -1.79769313486232E+308 && Closes[0][0]: 3845 > sessionHigh: -1.79769313486232E+308
Where you wanting to set sessionHigh to double.MaxValue at 160000?- At the start of each new trading session (when ToTime(Time[0]) == 93000), I reset sessionHigh to double.MinValue. This is done to begin tracking a new maximum High value for the current session.
- Then, within the time frame from 16:00 of the previous day to 9:30 of the current day (as defined in the condition ToTime(Time[0]) >= 160000 || ToTime(Time[0]) < 93000), sessionHigh is updated if the current High value is greater than the current sessionHigh value. This allows me to track the maximum High value formed within the specified time interval.
- After 9:30 in the current day, my code checks the condition Closes[0][0] > sessionHigh. If the current closing price breaks above sessionHigh, a long position is entered (EnterLong("LongPosition")).
In this way, my code attempts to enter a position if the current closing price surpasses the maximum High value formed in the time interval from 16:00 of the previous day to 9:30 of the current day.
Comment
-
Hello Anquirk,
"At the start of each new trading session (when ToTime(Time[0]) == 93000), I reset sessionHigh to double.MinValue. This is done to begin tracking a new maximum High value for the current session."
So sessionHigh will always be double.MinValue between 930000 and 160000.
"Then, within the time frame from 16:00 of the previous day to 9:30 of the current day (as defined in the condition ToTime(Time[0]) >= 160000 || ToTime(Time[0]) < 93000), sessionHigh is updated if the current High value is greater than the current sessionHigh value. This allows me to track the maximum High value formed within the specified time interval."
sessionHigh != double.MinValue will never be true between 930000 and 160000.
"After 9:30 in the current day, my code checks the condition Closes[0][0] > sessionHigh. If the current closing price breaks above sessionHigh, a long position is entered (EnterLong("LongPosition"))."
Close[0][0] will always be greater than double.MinValue between 930000 and 160000.
Are you seeing in the output between 9:30 and 16:00 that sessionHigh is not equal to double.MinValue?
Chelsea B.NinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_ChelseaB View PostHello Anquirk,
"At the start of each new trading session (when ToTime(Time[0]) == 93000), I reset sessionHigh to double.MinValue. This is done to begin tracking a new maximum High value for the current session."
So sessionHigh will always be double.MinValue between 930000 and 160000.
"Then, within the time frame from 16:00 of the previous day to 9:30 of the current day (as defined in the condition ToTime(Time[0]) >= 160000 || ToTime(Time[0]) < 93000), sessionHigh is updated if the current High value is greater than the current sessionHigh value. This allows me to track the maximum High value formed within the specified time interval."
sessionHigh != double.MinValue will never be true between 930000 and 160000.
"After 9:30 in the current day, my code checks the condition Closes[0][0] > sessionHigh. If the current closing price breaks above sessionHigh, a long position is entered (EnterLong("LongPosition"))."
Close[0][0] will always be greater than double.MinValue between 930000 and 160000.
Are you seeing in the output between 9:30 and 16:00 that sessionHigh is not equal to double.MinValue?
// Instead of resetting the sessionHigh at 9:30 today, I reset it only at the beginning of a new trading session (16:00 of the current day).
if (ToTime(Time[0]) == 160000)
{
sessionHigh = double.MinValue;
tradeExecutedToday = false;
And now it works fine
But here is another thing. The long position entry occur only if the price breaks sessionHigh on bar CLOSE. Is there any option to makes entry right in breakout? I found that I can't use last or ask or market price. I should mention that I need it for backtestingLast edited by Anquirk; 01-31-2024, 05:18 PM.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by Haiasi, 04-25-2024, 06:53 PM
|
2 responses
17 views
0 likes
|
Last Post
by Massinisa
Today, 05:32 AM
|
||
Started by Creamers, Today, 05:32 AM
|
0 responses
5 views
0 likes
|
Last Post
by Creamers
Today, 05:32 AM
|
||
Net Change
by Segwin
Started by Segwin, 05-07-2018, 02:15 PM
|
12 responses
1,786 views
0 likes
|
Last Post
by Leafcutter
Today, 05:30 AM
|
||
Started by poplagelu, Today, 05:00 AM
|
0 responses
3 views
0 likes
|
Last Post
by poplagelu
Today, 05:00 AM
|
||
Started by fx.practic, 10-15-2013, 12:53 AM
|
5 responses
5,408 views
0 likes
|
Last Post
by Bidder
Today, 12:22 AM
|
Comment