NexusFi: Find Your Edge


Home Menu

 





How to create Market order for Bollinger Band SE and LE


Discussion in MultiCharts

Updated
    1. trending_up 3,798 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 12 posts
    2. attach_file 0 attachments




 
Search this Thread

How to create Market order for Bollinger Band SE and LE

  #1 (permalink)
hoang101483
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);
}
}
}

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
Futures True Range Report
The Elite Circle
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
61 thanks
Funded Trader platforms
38 thanks
NexusFi site changelog and issues/problem reporting
26 thanks
GFIs1 1 DAX trade per day journal
19 thanks
The Program
18 thanks
  #2 (permalink)
hoang101483
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

Reply With Quote
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623


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
  #4 (permalink)
hoang101483
Oklahoma City USA
 
Posts: 47 since Oct 2016
Thanks Given: 0
Thanks Received: 1


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
  #5 (permalink)
hoang101483
Oklahoma City USA
 
Posts: 47 since Oct 2016
Thanks Given: 0
Thanks Received: 1


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
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

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
  #7 (permalink)
hoang101483
Oklahoma City USA
 
Posts: 47 since Oct 2016
Thanks Given: 0
Thanks Received: 1


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
  #8 (permalink)
hoang101483
Oklahoma City USA
 
Posts: 47 since Oct 2016
Thanks Given: 0
Thanks Received: 1


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
  #9 (permalink)
hoang101483
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

Reply With Quote
  #10 (permalink)
hoang101483
Oklahoma City USA
 
Posts: 47 since Oct 2016
Thanks Given: 0
Thanks Received: 1


Pump. Would someone please help me !

Reply With Quote




Last Updated on October 25, 2016


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts