Dark Theme
Light Theme
Trading Articles
Article Categories
Article Tools
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)
Updated October 25, 2016
trending_up
4,097 views
thumb_up
0 thanks given
group
3 followers
forum
12 posts
attach_file
0 attachments
October 24th, 2016, 11:28 AM
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks Given: 0
Thanks Received: 1
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);
}
}
}
Can you help answer these questions from other members on NexusFi?
Best Threads (Most Thanked) in the last 7 days on NexusFi
October 24th, 2016, 11:34 AM
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks Given: 0
Thanks Received: 1
This is the error I'm getting
https://snag.gy/KyavZo.jpg
October 24th, 2016, 01:15 PM
Posts: 2,439 since Apr 2013
Thanks Given: 486
Thanks Received: 1,631
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
October 24th, 2016, 01:40 PM
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks Given: 0
Thanks Received: 1
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);
October 24th, 2016, 01:42 PM
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks Given: 0
Thanks Received: 1
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?
October 24th, 2016, 01:58 PM
Posts: 2,439 since Apr 2013
Thanks Given: 486
Thanks Received: 1,631
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
October 24th, 2016, 02:01 PM
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks Given: 0
Thanks Received: 1
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);
October 24th, 2016, 02:13 PM
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks Given: 0
Thanks Received: 1
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);
}
}
}
October 24th, 2016, 02:41 PM
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks Given: 0
Thanks Received: 1
ABCTG,
Please Please help me. tI would a lot to me if I can automate this strategy
October 25th, 2016, 04:08 PM
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks Given: 0
Thanks Received: 1
Pump. Would someone please help me !
Last Updated on October 25, 2016