Trading Articles
Article Categories
Article Tools
Need help with a profitable automated trading strategy
Updated October 26, 2016
trending_up
5,376 views
thumb_up
0 thanks given
group
5 followers
forum
41 posts
attach_file
2 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)
Need help with a profitable automated trading strategy
(login for full post details)
#1 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
Hello all,
I have this strategy that is highly profitable using the default signals in Multicharts that I had backtest with 1 year of tick data on ES and NQ . When I turn on automated trading, it seem to work correctly when using a Sims account, but when apply to my live account the system will reject the order since the exit signal is a STOP order and if the current price is above the sell then it will get auto reject my broker (AMP futures). This is why I'm looking for PowerLanguage coder to help me to write a custom code.
the system is highly profitable. EX: if starting $10,00 account you can make $100,000 annually on ES or double that if you trade NQ at the same time using 1 contract . This number has already already accounted for commission and slippage (I added $50 slippage per trade on ES and $40 on NQ to be super conservative). Draw down is relatively small around $2,000 when compare to profit
my proposal is that if anyone interested to get a copy for this highly profitable strategy, please reply to this thread or email at Cooperahoang [at] gmail.com and we can discuses further. All I need you to do to use PowerLangue to fine tune the default cookie cutter signals that Multicharts provided by default.
Best Threads (Most Thanked) in the last 7 days on futures io
(login for full post details)
#2 (permalink )
Milan (Italy)
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
Posts: 98 since Dec 2014
Thanks: 7 given,
9
received
Hi, I can hel you if you explain the strategy to develop in EL
Sent using the futures.io mobile app
(login for full post details)
#3 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
tradingest
Hi, I can hel you if you explain the strategy to develop in EL
Sent using the
I'm not sure EL is compatible with the Auto Trading function of Multichart .NET.
But I want to buy Market when the close of the candle cross above Lower Bollinger Band and Sell Market when close of price cross below Higher Bollinger band. That is it. It is fairly simple.
Please note on the default Bollinger band signal use stop order to enter and exit market and this is why the auto trading doesn't not work on the live account since the broker will reject. I hope that market order will solve this issue.
(login for full post details)
#4 (permalink )
Milan (Italy)
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
Posts: 98 since Dec 2014
Thanks: 7 given,
9
received
the markets where the strategy works well is NQ and ES? Let you know where the strategy is done in EL ok? Why you don't use EL but .NET?
Sent using the futures.io mobile app
(login for full post details)
#5 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
tradingest
the markets where the strategy works well is NQ and ES? Let you know where the strategy is done in EL ok? Why you don't use EL but .NET?
Sent using the
Yes I trade mainly ES and NQ for now so I only tested the strategy on this market. Potentially will work other market since the strategy is simple.
The reason I don't use EL is because my broker provide the .NET version for free so that is why I use it. I might look into the regular version of Multicharts if I can get it for free.
yes please reply with the code here once you done and if it work with auto trading then will email you a copy of the strategy.
(login for full post details)
#6 (permalink )
Milan (Italy)
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
Posts: 98 since Dec 2014
Thanks: 7 given,
9
received
can you explain better the request that you want? The rules is not completely clear.
Sent using the futures.io mobile app
(login for full post details)
#7 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
tradingest
can you explain better the request that you want? The rules is not completely clear.
Sent using the
Sure.
Long Entry: Buy Market when close of candle cross above Lower Bollinger Band
Long Exit: Sell Market when close of candle cross below Higher Bollinger Band
Short Entry : Sell Market when close of candle cross below Higher Bollinger Band
SHORT Exit: Buy Market when close of candle cross above Lower Bollinger Band
(login for full post details)
#8 (permalink )
Milan (Italy)
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
Posts: 98 since Dec 2014
Thanks: 7 given,
9
received
hoang101483
Sure.
Long Entry: Buy Market when close of candle cross above Lower Bollinger Band
Long Exit: Sell Market when close of candle cross below Higher Bollinger Band
Short Entry : Sell Market when close of candle cross below Higher Bollinger Band
SHORT Exit: Buy Market when close of candle cross above Lower Bollinger Band
what is the time frame used for this rules?
Sent using the futures.io mobile app
(login for full post details)
#9 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
tradingest
what is the time frame used for this rules?
Sent using the
I don't want to give out to much information about the strategy. But you can use any timeframe.
(login for full post details)
#10 (permalink )
Milan (Italy)
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
Posts: 98 since Dec 2014
Thanks: 7 given,
9
received
I use the implicit time frame into code....if I don't know it's very complicated
Sent using the futures.io mobile app
(login for full post details)
#11 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
tradingest
I use the implicit time frame into code....if I don't know it's very complicated
Sent using the
I understand. It would be great if you code without implied time frame. Most signals are not time dependent anyways
(login for full post details)
#12 (permalink )
Milan (Italy)
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
Posts: 98 since Dec 2014
Thanks: 7 given,
9
received
all the strategy are based on time frame chart. Implicit tf allow you to see the chart a each tf without modify strategy. This is my develop
Sent using the futures.io mobile app
(login for full post details)
#13 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
tradingest
all the strategy are based on time frame chart. Implicit tf allow you to see the chart a each tf without modify strategy. This is my develop
Sent using the
Okay. I'm not sure about coding. But all the default signals can be apply to any timeframe so that why I said it not time dependent
(login for full post details)
#14 (permalink )
Milan (Italy)
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
Posts: 98 since Dec 2014
Thanks: 7 given,
9
received
hoang101483
Okay. I'm not sure about coding. But all the default signals can be apply to any timeframe so that why I said it not time dependent
mine development no because is the code that apply the tf
Sent using the futures.io mobile app
(login for full post details)
#15 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
Pump.
Any powerlanguage coder please reply if interested in getting my profitable strategy
(login for full post details)
#16 (permalink )
Milan (Italy)
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
Posts: 98 since Dec 2014
Thanks: 7 given,
9
received
hoang101483
Pump.
Any powerlanguage coder please reply if interested in getting my profitable strategy
I have made the strategy and backtesting on different time frame. The strategy is bad on the rules leave here.
(login for full post details)
#17 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
Would you please post the code here?
I would have to test to see if it signalling correctly
(login for full post details)
#18 (permalink )
Milan (Italy)
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
Posts: 98 since Dec 2014
Thanks: 7 given,
9
received
the signal is correct following your rules write below in the previous post. I test the code with different tf but the strategy is not completed because the performance report is very bad.
Sent using the futures.io mobile app
(login for full post details)
#19 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
Like I told you if you want copy of strategy I need your code to validate it first. Once everything good to go. I'll give copy and you will understand why your test give terrible result
(login for full post details)
#20 (permalink )
Miami Lakes
Experience: Beginner
Platform: Multicharts
Broker: Interactive Brokers
Trading: Emini ES
Posts: 19 since Oct 2016
Thanks: 2 given,
3
received
hoang101483
Sure.
Long Entry: Buy Market when close of candle cross above Lower Bollinger Band
Long Exit: Sell Market when close of candle cross below Higher Bollinger Band
Short Entry : Sell Market when close of candle cross below Higher Bollinger Band
SHORT Exit: Buy Market when close of candle cross above Lower Bollinger Band
I think this is what you are looking for:
inputs:
Length( 20 ),
NumDevs( 2 ) ;
variables:
UpperBand( 0 ),
LowerBand( 0 );
UpperBand = BollingerBand( Close, Length, NumDevs );
LowerBand = BollingerBand( Close, Length, -NumDevs );
condition1 = CurrentBar > 1 and Close crosses over UpperBand;
if condition1 then
Buy ( "BB_LE" ) next bar at market;
condition2 = CurrentBar > 1 and Close crosses under LowerBand;
if condition2 then
Sell Short ( "BB_SE" ) next bar at market;
if (MarketPosition = 1) then
begin
if (Close crosses under UpperBand) then sell ("BB_LX") next bar at market;
end;
if (MarketPosition = -1) then
begin
if (Close crosses over LowerBand) then buytocover ("BB_SX") next bar at market;
end;
However, I don't think it can profitable with such simple rules, in any timeframe. It would be too easy.
(login for full post details)
#21 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
alex20037
I think this is what you are looking for:
inputs:
Length( 20 ),
NumDevs( 2 ) ;
variables:
UpperBand( 0 ),
LowerBand( 0 );
UpperBand = BollingerBand( Close, Length, NumDevs );
LowerBand = BollingerBand( Close, Length, -NumDevs );
condition1 = CurrentBar > 1 and Close crosses over UpperBand;
if condition1 then
Buy ( "BB_LE" ) next bar at market;
condition2 = CurrentBar > 1 and Close crosses under LowerBand;
if condition2 then
Sell Short ( "BB_SE" ) next bar at market;
if (MarketPosition = 1) then
begin
if (Close crosses under UpperBand) then sell ("BB_LX") next bar at market;
end;
if (MarketPosition = -1) then
begin
if (Close crosses over LowerBand) then buytocover ("BB_SX") next bar at market;
end;
However, I don't think it can profitable with such simple rules, in any timeframe. It would be too easy.
Thank you. can this code be applied to PowerLanguage on the Multichart .NET?
I tried but it failed.
(login for full post details)
#22 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
This code doesn't seem to work with PowerLanguage Editor. I tried to added as Signals using C# and VB#NET but both failed. Can you tell me what I'm doing wrong here?
(login for full post details)
#23 (permalink )
Miami Lakes
Experience: Beginner
Platform: Multicharts
Broker: Interactive Brokers
Trading: Emini ES
Posts: 19 since Oct 2016
Thanks: 2 given,
3
received
hoang101483
Thank you. can this code be applied to PowerLanguage on the Multichart .NET?
I tried but it failed.
This is for Multicharts
(login for full post details)
#24 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
alex20037
Alex, Can you code this in PowerLanguage?
I will return your favor with copy of my profitable strategy
(login for full post details)
#25 (permalink )
Milan (Italy)
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
Posts: 98 since Dec 2014
Thanks: 7 given,
9
received
hoang101483
Alex, Can you code this in PowerLanguage?
The code offered by Alex is power language. You have need the C# code to run the strategy in .NET platform
Sent using the futures.io mobile app
(login for full post details)
#26 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
tradingest
The code offered by Alex is power language. You have need the C# code to run the strategy in .NET platform
Sent using the
futures.io mobile app
Tradingest,
Thanks for the clarification. The editor named powerlanguage so I thought that what it is. Great to know.
(login for full post details)
#27 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
I was able to get the code kinda work. But need further refinement. You can find the thread here. Can you help?
(login for full post details)
#28 (permalink )
Miami Lakes
Experience: Beginner
Platform: Multicharts
Broker: Interactive Brokers
Trading: Emini ES
Posts: 19 since Oct 2016
Thanks: 2 given,
3
received
hoang101483
Tradingest,
Thanks for the clarification. The editor named powerlanguage so I thought that what it is. Great to know.
No problem here is the code in C# . I am really interested in seeing how you can get this strategy to work, please do share the results with me.
using System;
namespace PowerLanguage.Strategy
{
public class BB : SignalObject
{
private IOrderMarket m_BBandLE;
private IOrderMarket m_BBandLX;
private IOrderMarket m_BBandSE;
private IOrderMarket m_BBandSX;
public BB(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;
private VariableSeries<double> m_UpperBand;
protected override void Create()
{
m_LowerBand = new VariableSeries<Double>(this);
m_UpperBand = new VariableSeries<Double>(this);
m_BBandLE = OrderCreator.MarketNextBar(new SOrderParameters(Contracts .Default, "BBandLE", EOrderAction.Buy));
m_BBandLX = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, "BBandLX", EOrderAction.Sell));
m_BBandSE = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, "BBandSE", EOrderAction.SellShort));
m_BBandSX = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, "BBandSX", EOrderAction.BuyToCover));
}
protected override void CalcBar()
{
m_LowerBand.Value = Bars.Close.BollingerBandCustom(Length, -NumDevsDn);
m_UpperBand.Value = Bars.Close.BollingerBandCustom(Length, NumDevsDn);
if (CurrentPosition.Value == 0) {
if (Bars.CurrentBar > 1 && Bars.Close.CrossesOver(m_LowerBand, ExecInfo.MaxBarsBack))
m_BBandLE.Send();
if (Bars.CurrentBar > 1 && Bars.Close.CrossesUnder(m_UpperBand, ExecInfo.MaxBarsBack))
m_BBandSE.Send();
}
if (CurrentPosition.Value > 0) {
if (Bars.CurrentBar > 1 && Bars.Close.CrossesUnder(m_UpperBand, ExecInfo.MaxBarsBack))
m_BBandLX.Send();
}
if (CurrentPosition.Value < 0) {
if (Bars.CurrentBar > 1 && Bars.Close.CrossesOver(m_LowerBand, ExecInfo.MaxBarsBack))
m_BBandSX.Send();
}
}
}
}
(login for full post details)
#29 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
Thanks Alex,
I compiled it, didn't give back an error, but It still show Unverified.
Can you double check the code to see if we missing anything?
(login for full post details)
#30 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
It said build suceeded, but still have that RED icon next to the signal icon on the list on the left hand. does it work on your computer? Perhaps I need to reboot mine?
(login for full post details)
#31 (permalink )
Miami Lakes
Experience: Beginner
Platform: Multicharts
Broker: Interactive Brokers
Trading: Emini ES
Posts: 19 since Oct 2016
Thanks: 2 given,
3
received
hoang101483
It said build suceeded, but still have that RED icon next two the signal icon list. does it works on your computer? Perhaps I need to reboot mine?
It works for me just fine. See attached, you should be able to unzip and import it to your Multicharts.NET . I have the latest version.
(login for full post details)
#32 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
alex20037
It works for me just fine. See attached, you should be able to unzip and import it to your
Multicharts.NET . I have the latest version.
Thanks Alex,
It is working now. One small issue. If you open the default BB LE and SE it will basically reverse at each signal. Can we do exactly that?
Your code basically have entry long, exit long and vice versa instead of reversal at each signal. If you add the signal to the chart, you will see what I'm talking about. I wonder if you code each signal on a separate file would fix this issue. Let me know if you can fix this.
(login for full post details)
#33 (permalink )
Miami Lakes
Experience: Beginner
Platform: Multicharts
Broker: Interactive Brokers
Trading: Emini ES
Posts: 19 since Oct 2016
Thanks: 2 given,
3
received
hoang101483
Thanks Alex,
It is working now. One small issue. If you open the default BB LE and SE it will basically
reverse at each signal. Can we do exactly that?
Your code basically have entry long, exit long and vice versa instead of reversal at each signal. If you add the signal to the chart, you will see what I'm talking about. I wonder if you code each signal on a separate file would fix this issue. Let me know if you can fix this.
See attached now. I can't get it to actually show the reverse in the chart, show 2 contracts instead of 1, that'll be something to look into later on when we have good numbers. But you can see that it is doing it, if you see the performance report for example. So if it is long one contract it sells it and short sells a second one, if it is short then it covers it and then buys another one.
(login for full post details)
#34 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
Alex,
thanks for that. i think you misunderstood me. you see how the default bb has LE and SE. what we can do is spliting up the BB file into two file. one foe LE LX, another for SE and SX. this way we have perfect reversal I hope. let me know if you can do it
(login for full post details)
#35 (permalink )
Miami Lakes
Experience: Beginner
Platform: Multicharts
Broker: Interactive Brokers
Trading: Emini ES
Posts: 19 since Oct 2016
Thanks: 2 given,
3
received
hoang101483
Alex,
thanks for that. i think you misunderstood me. you see how the default bb has LE and SE. what we can do is spliting up the BB file into two file. one foe LE LX, another for SE and SX. this way we have perfect reversal I hope. let me know if you can do it
Splitting in two files won't make a difference, code is still the same. I will look into it when I have a chance, however this is for sure doing now what we want to, see the strategy performance report please, it does reverse , only doesn't show in the chart.
I was looking and also the you see how the default bb LE and SE that come with multicharts also behave like this, they do reverse, but the chart only shows the new open order.
(login for full post details)
#36 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
Alex,
I got it to work. Here is the code
using System;
namespace PowerLanguage.Strategy
{
public class BB : SignalObject
{
private IOrderMarket m_BBandLE;
private IOrderMarket m_BBandLX;
private IOrderMarket m_BBandSE;
private IOrderMarket m_BBandSX;
public BB(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;
private VariableSeries<double> m_UpperBand;
protected override void Create()
{
m_LowerBand = new VariableSeries<Double>(this);
m_UpperBand = new VariableSeries<Double>(this);
m_BBandLE = OrderCreator.MarketNextBar(new SOrderParameters(Contracts .Default, "BBandLE", EOrderAction.Buy));
m_BBandLX = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, "BBandLX", EOrderAction.SellShort));
m_BBandSE = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, "BBandSE", EOrderAction.SellShort));
m_BBandSX = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, "BBandSX", EOrderAction.Buy));
}
protected override void CalcBar()
{
m_LowerBand.Value = Bars.Close.BollingerBandCustom(Length, -NumDevsDn);
m_UpperBand.Value = Bars.Close.BollingerBandCustom(Length, NumDevsDn);
if (CurrentPosition.Value == 0) {
if (Bars.CurrentBar > 1 && Bars.Close.CrossesOver(m_LowerBand, ExecInfo.MaxBarsBack))
m_BBandLE.Send();
if (Bars.CurrentBar > 1 && Bars.Close.CrossesUnder(m_UpperBand, ExecInfo.MaxBarsBack))
m_BBandSE.Send();
}
if (CurrentPosition.Value > 0) {
if (Bars.CurrentBar > 1 && Bars.Close.CrossesUnder(m_UpperBand, ExecInfo.MaxBarsBack))
m_BBandLX.Send();
}
if (CurrentPosition.Value < 0) {
if (Bars.CurrentBar > 1 && Bars.Close.CrossesOver(m_LowerBand, ExecInfo.MaxBarsBack))
m_BBandSX.Send();
}
}
}
}
(login for full post details)
#37 (permalink )
Miami Lakes
Experience: Beginner
Platform: Multicharts
Broker: Interactive Brokers
Trading: Emini ES
Posts: 19 since Oct 2016
Thanks: 2 given,
3
received
I guess now the question is, how do we make this profitable long term?
(login for full post details)
#38 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
argh. never mind. It did create a double order. so That code didn't work
(login for full post details)
#39 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
Alex,
I think the issue is somewhere here.
protected override void CalcBar()
{
m_LowerBand.Value = Bars.Close.BollingerBandCustom(Length, -NumDevsDn);
m_UpperBand.Value = Bars.Close.BollingerBandCustom(Length, NumDevsDn);
if (CurrentPosition.Value == 0) {
if (Bars.CurrentBar > 1 && Bars.Close.CrossesOver(m_LowerBand, ExecInfo.MaxBarsBack))
m_BBandLE.Send();
if (Bars.CurrentBar > 1 && Bars.Close.CrossesUnder(m_UpperBand, ExecInfo.MaxBarsBack))
m_BBandSE.Send();
}
if (CurrentPosition.Value > 0) {
if (Bars.CurrentBar > 1 && Bars.Close.CrossesUnder(m_UpperBand, ExecInfo.MaxBarsBack))
m_BBandLX.Send();
}
if (CurrentPosition.Value < 0) {
if (Bars.CurrentBar > 1 && Bars.Close.CrossesOver(m_LowerBand, ExecInfo.MaxBarsBack))
m_BBandSX.Send();
}
}
}
}
(login for full post details)
#40 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
I think I might have fixed the issue by getting rid of the position argument all together
using System;
namespace PowerLanguage.Strategy
{
public class BB : SignalObject
{
private IOrderMarket m_BBandLE;
private IOrderMarket m_BBandLX;
private IOrderMarket m_BBandSE;
private IOrderMarket m_BBandSX;
public BB(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;
private VariableSeries<double> m_UpperBand;
protected override void Create()
{
m_LowerBand = new VariableSeries<Double>(this);
m_UpperBand = new VariableSeries<Double>(this);
m_BBandLE = OrderCreator.MarketNextBar(new SOrderParameters(Contracts .Default, "BBandLE", EOrderAction.Buy));
m_BBandLX = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, "BBandLX", EOrderAction.SellShort));
m_BBandSE = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, "BBandSE", EOrderAction.Sell));
m_BBandSX = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, "BBandSX", EOrderAction.BuyToCover));
}
protected override void CalcBar()
{
m_LowerBand.Value = Bars.Close.BollingerBandCustom(Length, -NumDevsDn);
m_UpperBand.Value = Bars.Close.BollingerBandCustom(Length, NumDevsDn);
if (Bars.CurrentBar > 1 && Bars.Close.CrossesOver(m_LowerBand, ExecInfo.MaxBarsBack))
m_BBandLE.Send();
if (Bars.CurrentBar > 1 && Bars.Close.CrossesUnder(m_UpperBand, ExecInfo.MaxBarsBack))
m_BBandSE.Send();
if (Bars.CurrentBar > 1 && Bars.Close.CrossesUnder(m_UpperBand, ExecInfo.MaxBarsBack))
m_BBandLX.Send();
if (Bars.CurrentBar > 1 && Bars.Close.CrossesUnder(m_UpperBand, ExecInfo.MaxBarsBack))
m_BBandLX.Send();
}
}
}
(login for full post details)
#41 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
oh man. That worked on the sim only.
Alex,
I guess we need to fix it somehow
(login for full post details)
#42 (permalink )
Oklahoma City USA
Posts: 47 since Oct 2016
Thanks: 0 given,
1
received
Alex,
also let me know if you use TradingView. We can chat up there more easily to discuss
Last Updated on October 26, 2016
Right now
Ongoing
Coming soon
March
Register to Attend
Elite only
Register to Attend
Elite only
Right now
April