Trading Articles
Article Categories
Article Tools
How to create Market order for Bollinger Band SE and LE
Updated October 25, 2016
trending_up
2,196 views
thumb_up
0 thanks given
group
3 followers
forum
12 posts
attach_file
0 attachments
Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
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 and simple.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
How to create Market order for Bollinger Band SE and LE
(login for full post details)
#1 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
Hi all,
I'm struggling to rewrite the defaults Bollinger Band SE LE signal. I want enter and exit based on market order . I tried something like below. I changed private IOrderMarket m_BBandLE; AND m_BBandLE = OrderCreator.MarketNextBar (new SOrderParameters(Contracts .Default, "BBandLE", EOrderAction.Buy)); as you see below. I'm getting getting an error.
using System;
namespace PowerLanguage.Strategy
{
public class Bollinger_Bands_LE : SignalObject
{
private IOrderMarket m_BBandLE;
public Bollinger_Bands_LE(object ctx) :
base(ctx)
{
Length = 20;
NumDevsDn = 2;
}
[Input]
public int Length { get; set; }
[Input]
public double NumDevsDn { get; set; }
private VariableSeries<double> m_LowerBand;
protected override void Create()
{
m_LowerBand = new VariableSeries<Double>(this);
m_BBandLE = OrderCreator.Stop(new SOrderParameters(Contracts.Default, "BBandLE", EOrderAction.Buy));
}
protected override void CalcBar()
{
m_LowerBand.Value = Bars.Close.BollingerBandCustom(Length, -NumDevsDn);
if (Bars.CurrentBar > 1 && Bars.Close.CrossesOver(m_LowerBand, ExecInfo.MaxBarsBack))
m_BBandLE.Send(m_LowerBand.Value);
}
}
}
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#3 (permalink )
Posts: 2,230 since Apr 2013
Thanks: 409 given,
1,471
received
hoang101483,
take a look at the MC.NET programming guide . Besides explaining how to operate the different order types, you can likely use the code snippet in section 2.2. and adapt it to your needs.
Regards,
ABCTG
(login for full post details)
#4 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
ABCTG
hoang101483,
take a look at the
MC.NET programming guide . Besides explaining how to operate the different order types, you can likely use the code snippet in section 2.2. and adapt it to your needs.
Regards,
ABCTG
ABCTG,
Thanks for for the link. I tried to modify it but still getting the same error. Something is wrong with this part. Can you help me?
m_LowerBand.Value = Bars.Close.BollingerBandCustom(Length, -NumDevsDn);
if (Bars.CurrentBar > 1 && Bars.Close.CrossesOver(m_LowerBand, ExecInfo.MaxBarsBack))
m_BBandLE.Send(m_LowerBand.Value);
(login for full post details)
#5 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
hoang101483
ABCTG,
Thanks for for the link. I tried to modify it but still getting the same error. Something is wrong with this part. Can you help me?
m_LowerBand.Value = Bars.Close.BollingerBandCustom(Length, -NumDevsDn);
if (Bars.CurrentBar > 1 && Bars.Close.CrossesOver(m_LowerBand, ExecInfo.MaxBarsBack))
m_BBandLE.Send(m_LowerBand.Value);
It is saying can not double to init.... Can you tell me how to fix it?
(login for full post details)
#6 (permalink )
Posts: 2,230 since Apr 2013
Thanks: 409 given,
1,471
received
hoang101483,
you are trying to send the value of the bollinger band as quantity of a market order . You can for example issue the order without specifying a quantity and have MC use the default one as specified in your workspace.
Regards,
ABCTG
(login for full post details)
#7 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
ABCTG
hoang101483,
you are trying to send the value of the bollinger band as quantity of a
market order . You can for example issue the order without specifying a quantity and have MC use the default one as specified in your workspace.
Regards,
ABCTG
Can you just tell me how to fix it. I'm not very good with coding. I tried this. But failed.
m_HigherBand.Value = Bars.Close.BollingerBandCustom(Length, NumDevsUp);
if ( Bars.Close.CrossesUnder(m_HigherBand, ExecInfo.MaxBarsBack))
m_BBandSE.Send(m_HigherBand.Value);
(login for full post details)
#8 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
hoang101483
Can you just tell me how to fix it. I'm not very good with coding. I tried this. But failed.
m_HigherBand.Value = Bars.Close.BollingerBandCustom(Length, NumDevsUp);
if ( Bars.Close.CrossesUnder(m_HigherBand, ExecInfo.MaxBarsBack))
m_BBandSE.Send(m_HigherBand.Value);
This is what I have currently. which line do I need to fix?
using System;
namespace PowerLanguage.Strategy
{
public class Bollinger_Bands_LE : SignalObject
{
private IOrderMarket m_BBandLE;
public Bollinger_Bands_LE(object ctx) :
base(ctx)
{
Length = 10;
NumDevsDn = 1;
}
[Input]
public int Length { get; set; }
[Input]
public double NumDevsDn { get; set; }
private VariableSeries<double> m_LowerBand;
protected override void Create()
{
m_LowerBand = new VariableSeries<Double>(this);
m_BBandLE = OrderCreator.MarketNextBar(new SOrderParameters(Contracts .Default, "BBandLE", EOrderAction.Buy));
}
protected override void CalcBar()
{
m_LowerBand.Value = Bars.Close.BollingerBandCustom(Length, -NumDevsDn);
if (Bars.CurrentBar > 1 && Bars.Close.CrossesOver(m_LowerBand, ExecInfo.MaxBarsBack))
m_BBandLE.Send(m_LowerBand.Value);
}
}
}
(login for full post details)
#9 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
ABCTG,
Please Please help me. tI would a lot to me if I can automate this strategy
(login for full post details)
#10 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
Pump. Would someone please help me !
(login for full post details)
#11 (permalink )
Posts: 2,230 since Apr 2013
Thanks: 409 given,
1,471
received
hoang101483,
the original order in your code was a stop order and needed a stop price - this is what you left in the order. As the market order has no stop price, you can remove it and change.
Code
m_BBandLE.Send(m_LowerBand.Value);
to
Regards,
ABCTG
(login for full post details)
#12 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
ABCTG
hoang101483,
the original order in your code was a
stop order and needed a
stop price - this is what you left in the order. As the
market order has no stop price, you can remove it and change.
Code
m_BBandLE.Send(m_LowerBand.Value);
to
Regards,
ABCTG
Thanks ABCTG,
That worked. I was to to exit at market. But another issue arise where if I already have an open position. It simply close at market. It wouldn't enter another order. For example if there a LONG position open, when signal trigger I want to Sell at market, then submit another Sell order. I basically want to reverse at each signal. There is a way around this code?
(login for full post details)
#13 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
Another issue was that If I already have a SHORT position for example. If the signal give another sell signal, it would add another Sell order.
Basically all I want is Enter/Exit at market without adding another position in the same direction.
Last Updated on October 25, 2016
Right now
Ongoing
Coming soon
March
Register to Attend
Elite only
Register to Attend
Elite only
Right now
April