Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I am creating a multi time-frame strategy with four time frames and two indicators
In the onBarUpdate, I check for the primary bars (barsinprogress==0 return) and ignore it. When I backtest in 1 min ticks, I only get long trades. When I switch to 15 min, I get both. My questions is, are there 4 instances of each indicator running (5 if you count primary bars) when my strategy is active? I'm missing something but I just don't know what it is?
[NOTE]The Long and Short Indicators are not optimized in any way for multi-time frames. They were meant to be run in one time frame[/NOTE]
Can you help answer these questions from other members on NexusFi?
From what I gather by debugging it, there were 5 instances of LongIndicator and 5 instances of ShortIndicator running in my strategy at any given time. The code you see above is from the Initialize method method and it turns out that I was changing the value of shortVal in only the primary bars (which is what called the Initialize method) and not the 15/30/60/day bars. This was causing my unexpected results and once I changed the default value of shortVal to true, everything worked fine.
Clearly I'm screwing something up. The code below works partially. It appears to do everything except account for the EMA positions on the primary bars [0]. EMA 21 > EMA 34 for example.
It also freaks out and floods with placing and cancelling orders when I change the EnterLong or EnterShort to a limit order. The limit order is to be placed at the 13 MA, if that makes any difference.
/// <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.Tick, 2584);
Add(PeriodType.Second, 30);
Add(Swing(SwingStrength));