[Description("Enter the description of your strategy here")] public class LOWHIGHTEST : Strategy { #region Variables // Wizard generated variables private int myInput0 = 1; // Default setting for MyInput0 // User defined variables (add any user defined variables below) #endregion /// <summary> /// This method is used to configure the strategy and is called once before any strategy method is called. /// </summary> protected override void Initialize() {Add(PeriodType.Minute, 1); SetProfitTarget("", CalculationMode.Percent, 1); SetStopLoss("", CalculationMode.Ticks, 250, false); CalculateOnBarClose = false; } /// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { if (BarsInProgress == 0) { if (Range () [1] > 2) { EnterLong(1,1, "Long: 5min"); } } // When the OnBarUpdate() is called from the secondary bar series, do nothing. else { return; } }
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Mutli time Frame help needed
Collapse
X
-
Mutli time Frame help needed
Hi I want to enter a trade using 60 minutes strategy and entering into the trade on the 5 min chart..However for some reason it enters on the second candle (60 min) can you please check out the code and HELP ME with this. ALSO please look at the Picture better understanding.
Code: -
Hello,
Here is your issue:
if (BarsInProgress == 0)
{
if (Range () [1] > 2)
{
EnterLong(1,1, "Long: 5min");
}
So this will EnterLong as soon as BarsInProgress 0 calculates. Which is at the close of the 60 min bars which is working as expected.
You would need to change this entry logic to run on the 5 min bars instead. However if you ran the strategy live there would be no issue since you can run COBC = false and this will submit in realtime. However it backtest or historical it always runs COBC = true as we discussed in your other thread.
Let me know if I can be of further assistance.
-
First of all thank you for replaying back to me so soon. However, can you please advise how I should code the entry logic to run on the 5 min bars instead. This is my first time using Ninjatrader code to write a strategy. To be honest I am extremely confused I hope you can help me. thank you Ben
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by mly916, Today, 09:48 PM
|
0 responses
6 views
0 likes
|
Last Post
by mly916
Today, 09:48 PM
|
||
Started by Mikey_, Today, 09:21 PM
|
0 responses
10 views
0 likes
|
Last Post
by Mikey_
Today, 09:21 PM
|
||
Started by cre8able, Today, 05:53 PM
|
3 responses
13 views
0 likes
|
Last Post
by cre8able
Today, 09:20 PM
|
||
Started by Aryan Kumar, Today, 09:04 PM
|
0 responses
4 views
0 likes
|
Last Post
by Aryan Kumar
Today, 09:04 PM
|
||
Started by yertle, Yesterday, 05:49 PM
|
3 responses
16 views
0 likes
|
Last Post
by Mindset
Today, 08:38 PM
|
Comment