How to create Market order for Bollinger Band SE and LE - futures io
futures io futures trading



How to create Market order for Bollinger Band SE and LE


Discussion in MultiCharts

Updated
    1. trending_up 2,196 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 12 posts
    2. 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)

 
Search this Thread
 

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);
}
}
}

Reply With Quote

Journal Challenge February 2021 results:
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(173 thanks from 31 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(120 thanks from 33 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(35 thanks from 17 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 
 
(login for full post details)
  #2 (permalink)
Oklahoma City USA
 
 
Posts: 47 since Oct 2016
Thanks: 0 given, 1 received

This is the error I'm getting

https://snag.gy/KyavZo.jpg

Reply With Quote
 
(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

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #4 (permalink)
Oklahoma City USA
 
 
Posts: 47 since Oct 2016
Thanks: 0 given, 1 received


ABCTG View Post
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);

Reply With Quote
 
(login for full post details)
  #5 (permalink)
Oklahoma City USA
 
 
Posts: 47 since Oct 2016
Thanks: 0 given, 1 received


hoang101483 View Post
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?

Reply With Quote
 
(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

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #7 (permalink)
Oklahoma City USA
 
 
Posts: 47 since Oct 2016
Thanks: 0 given, 1 received


ABCTG View Post
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);

Reply With Quote
 
(login for full post details)
  #8 (permalink)
Oklahoma City USA
 
 
Posts: 47 since Oct 2016
Thanks: 0 given, 1 received


hoang101483 View Post
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);
}
}
}

Reply With Quote
 
(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

Reply With Quote
 
(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 !

Reply With Quote
 
(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
 
Code
m_BBandLE.Send();
Regards,

ABCTG

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #12 (permalink)
Oklahoma City USA
 
 
Posts: 47 since Oct 2016
Thanks: 0 given, 1 received


ABCTG View Post
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
 
Code
m_BBandLE.Send();
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?

Reply With Quote
 
(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.

Reply With Quote


futures io Trading Community Platforms and Indicators MultiCharts > How to create Market order for Bollinger Band SE and LE


Last Updated on October 25, 2016


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Call Option Buying: The New Pain Trade? w/Carley Garner

Elite only
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

New Challenge (TBD)

April
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts