Need help with a profitable automated trading strategy - futures io
futures io futures trading



Need help with a profitable automated trading strategy


Discussion in MultiCharts

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

 
Search this Thread
 

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.

Reply With Quote

Journal Challenge February 2021 results (so far):
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(166 thanks from 30 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(111 thanks from 32 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(31 thanks from 16 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 
 
(login for full post details)
  #2 (permalink)
Milan (Italy)
 
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
 
tradingest's Avatar
 
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

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



tradingest View Post
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.

Reply With Quote
 
(login for full post details)
  #4 (permalink)
Milan (Italy)
 
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
 
tradingest's Avatar
 
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

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


tradingest View Post
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.

Reply With Quote
 
(login for full post details)
  #6 (permalink)
Milan (Italy)
 
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
 
tradingest's Avatar
 
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

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


tradingest View Post
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

Reply With Quote
 
(login for full post details)
  #8 (permalink)
Milan (Italy)
 
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
 
tradingest's Avatar
 
Posts: 98 since Dec 2014
Thanks: 7 given, 9 received


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

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


tradingest View Post
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.

Reply With Quote
 
(login for full post details)
  #10 (permalink)
Milan (Italy)
 
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
 
tradingest's Avatar
 
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

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


tradingest View Post
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

Reply With Quote
 
(login for full post details)
  #12 (permalink)
Milan (Italy)
 
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
 
tradingest's Avatar
 
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

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


tradingest View Post
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

Reply With Quote
 
(login for full post details)
  #14 (permalink)
Milan (Italy)
 
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
 
tradingest's Avatar
 
Posts: 98 since Dec 2014
Thanks: 7 given, 9 received


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

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

Reply With Quote
 
(login for full post details)
  #16 (permalink)
Milan (Italy)
 
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
 
tradingest's Avatar
 
Posts: 98 since Dec 2014
Thanks: 7 given, 9 received


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

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

Reply With Quote
 
(login for full post details)
  #18 (permalink)
Milan (Italy)
 
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
 
tradingest's Avatar
 
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

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

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

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


alex20037 View Post
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.

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

Reply With Quote
 
(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 View Post
Thank you. can this code be applied to PowerLanguage on the Multichart .NET?

I tried but it failed.

This is for Multicharts

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


alex20037 View Post
This is for Multicharts

Alex, Can you code this in PowerLanguage?

I will return your favor with copy of my profitable strategy

Reply With Quote
 
(login for full post details)
  #25 (permalink)
Milan (Italy)
 
Experience: Advanced
Platform: TradeStation, MC, MT4
Broker: TradeStation, IB
Trading: Futures, Forex
 
tradingest's Avatar
 
Posts: 98 since Dec 2014
Thanks: 7 given, 9 received


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

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


tradingest View Post
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.

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

Reply With Quote
 
(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 View Post
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();
}

}
}
}

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

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

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

Attached Files
Register to download File Type: zip BB.zip (2.2 KB, 7 views)
Reply With Quote
 
(login for full post details)
  #32 (permalink)
Oklahoma City USA
 
 
Posts: 47 since Oct 2016
Thanks: 0 given, 1 received


alex20037 View Post
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.

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

Attached Files
Register to download File Type: zip BBv2.zip (2.3 KB, 8 views)
Reply With Quote
 
(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

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

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

}
}
}

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

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

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

}
}
}

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



}
}

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

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

Reply With Quote


futures io Trading Community Platforms and Indicators MultiCharts > Need help with a profitable automated trading strategy


Last Updated on October 26, 2016


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1500 prizes from Topstep!

February
 

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

March
     



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