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
HELP prgramming mutiple time frames in strategy wizard
Collapse
X
-
HELP prgramming mutiple time frames in strategy wizard
Is it possible to prgram a mutiple time strat in strategy wiazrd, we are building a 1 minute strat, that needs to look at the MACD cross on a 3 minute chart before executing the trade. Any ideas? Also we are looking for a method that will time the idications of trade. For example, our first condition is a EMA cross, following that we are looking for higher highs Etc, these need to occur no more then a max of 7 minutes after the cross before possible trade is disregarded. Your help is appreaciated... MIkeTags: None
-
You would need to roll up your sleeves and dig into NinjaScript coding. There is a wealth of information in the help guide e.g. here: http://www.ninjatrader-support.com/H...verview39.html
Also: check out SampleMultiTimeFrame strategy
As last resort there are certified NinjaScript consultants at your help: http://www.ninjatrader.com/webnew/pa...injaScript.htm
Comment
-
Is this correct code for 2 EMA crosses occuring in different time frames
is this the corect code?
if yes please post so that overs will be able to use it as a reference point to which they can control/use multiple time frames.
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
///<summary>
/// Enter the description of your strategy here
///</summary>
[Description("Enter the description of your strategy here")]
publicclass helpme : Strategy
{
#region Variables
// Wizard generated variables
privateint 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>
protectedoverridevoid Initialize()
{
Add(PeriodType.Minute,5);
Add(EMA(5));
Add(EMA(10));
SetProfitTarget("", CalculationMode.Ticks, 10);
SetStopLoss("", CalculationMode.Ticks, 3, true);
CalculateOnBarClose = true;
}
///<summary>
/// Called on each bar update event (incoming tick)
///</summary>
protectedoverridevoid OnBarUpdate()
{
// Condition set 1
if (CrossAbove(EMA(5), EMA(10), 7)
&& (BarsInProgress == 1)
&& CrossAbove(EMA (BarsArray[1], 5), EMA(BarsArray[1], 10), 7))
{
EnterLong(DefaultQuantity, "");
}
}
#region Properties
[Description("")]
[Category("Parameters")]
publicint MyInput0
{
get { return myInput0; }
set { myInput0 = Math.Max(1, value); }
}
#endregion
}
}
Comment
-
I think you might be being redundant in your conditions. If you limit your condition to work in BarsInProgress == 1 you are already in the secondary time frame at start. If you are in the secondary bars object this means EMA(5) is reflective of the secondary bars object and not the primary one. When you do EMA(BarsArray[1], 5) that is still the secondary bar object.Josh P.NinjaTrader Customer Service
Comment
-
To clarify:
- your code below looks ok. Josh just suggested an alternate, more efficient way to code which essentially would not change any logic -> you can leave
- NT 7 will support multi series indicators, but not multi series in the strategy wizard (nor indicator wizard), since multi series logic is way beyond basic level which could be not covered by a wizard
Comment
-
If you think it looks ok, I have one more question, the Ema was only an example maybe my Macd coding is wrong,
if (CrossAbove(Macd(BarsArray[1],12,26,9), Macd(BarsArray[1],12,26,9)
do something;
In my protectedoverridevoid Initialize()
My timeperiod= Add(PeriodType.Minute,3);
Guys I cant thank you enough for help, Id buy drinks if I could
Comment
-
I suggest debugging your strategy as per here: http://www.ninjatrader-support.com/v...ead.php?t=3418
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by ScottWalsh, Today, 06:52 PM
|
3 responses
19 views
0 likes
|
Last Post Today, 07:30 PM | ||
Started by trilliantrader, Today, 03:01 PM
|
2 responses
18 views
0 likes
|
Last Post
by helpwanted
Today, 07:25 PM
|
||
Started by cre8able, Today, 07:24 PM
|
0 responses
1 view
0 likes
|
Last Post
by cre8able
Today, 07:24 PM
|
||
Started by Haiasi, Today, 06:53 PM
|
1 response
4 views
0 likes
|
Last Post Today, 07:05 PM | ||
Started by ScottW, Today, 06:09 PM
|
1 response
7 views
0 likes
|
Last Post Today, 06:53 PM |
Comment