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)
Hi forrestang, Many thanks for your usefull imput.
I would like to ask you something else regarding the break out strategy. I am seeking to code the same idea about a monthly and 6 month break out. However, instead of increasing the execution number of trades they are decreasing. I was expecting ( all trades= weekly trades+monthly trades+6 month trades - the same breakout trades ) but the all trades < weekly trades. Do you know how this is happen ?
Can you help answer these questions from other members on NexusFi?
Sorry, but I'm not sure what it is you are asking?
What I scripted will buy/sell the break beyond the prior 5 bars. This doesn't matter if it's on a 5min, 60min, 1 day, 1 week or 1 month chart.
So if you want to have this work on say a weekly breakout of the prior 4 weeks(1 month), then put the strategy on a chart with bars constructed of 1 week, and set the variable I put in there called barNumber to 4.
If you want to buy/sell the breakdown of the prior 6 months, put the study on a chart of bars constructed of monthly values, and set the barNumber to 5.
The strategy doesn't care what bar interval/resolution you use.
I want the strategy to go long/short either when there is a breakout at 4, 22, 127 bars. So if there is a breakout one of those bars then it should execute a trade. For example, in a daily chart the startegy is going to check if there are 3 different break outs; if there is a breakout of the previous week (bar numeber 5) or breakout last month ( 22 ) or the last 6 months ( 127). If one of these breakout exist then it will execute a trade. However, in the code below instead of the number of trades through these 3 different bars increase they are decreaced.
All trades= weekly trades+monthly trades+6 month trades - the same breakout trades
The strategy with the 5 bars is executed more trades than the strategy which is include 5, 22 and 127 bars.
This new strategy should execute more trades compared to the strategy that you sent me but it doesnt!
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion
// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
/// <summary>
/// buys the break above 5 bars high
/// </summary>
[Description("buys the break above 5 bars high")]
public class LoukasBarBreakout : Strategy
{
#region Variables
private int barCount = 5; // Default setting for BarCount
private int monthCount = 22; // Default setting for Monthly
private int month6Count = 127; // Default setting for 6 Months
#region Properties
[Description("Number of Bars back to use in calculation")]
[GridCategory("Parameters")]
public int BarCount
{
get { return barCount; }
set { barCount = Math.Max(1, value); }
}
[Description("Number of Bars back to use in calculation")]
[GridCategory("Parameters")]
public int Month6Count
{
get { return month6Count; }
set { month6Count = Math.Max(1, value); }
}
[Description("Number of Bars back to use in calculation")]
[GridCategory("Parameters")]
public int MonthCount
{
get { return monthCount; }
set { monthCount = Math.Max(1, value); }
}
[Description("Target Size (in tics)")]
[GridCategory("Parameters")]
public int Target
{
get { return target; }
set { target = Math.Max(1, value); }
}
[Description("Stop Size (in tics)")]
[GridCategory("Parameters")]
public int Stop
{
get { return stop; }
set { stop = Math.Max(1, value); }
}
#endregion
}
}
Have you tried running each one of these periods you want to use independently of one another? And then seeing how many trades should be taken by each one alone? That would be the first thing to check via process of elimination.
Next, when you set this up to run, when you add it to a chart or when you start the back tester, did you hit the box to allow it to take more than one trade at a time?
Yes I have already run the strategy of each one of these periods independently. It is executed 127 trades for 5 bars and 58 for 22 bars but the aggregate strategy execute ony 115 trades which is not looks logical. I was not aware about the box which allow it to take more than one trade at a time, where is it?
I am running this in strategy analyzer, I think your are speaking about Order Properies which has 3 options 1. By default quantity 2. by strategy 3. by account size. I selected By Default quantity and then at the default quuantity box I entered 2 but it doesnt execute more trades.