NexusFi: Find Your Edge


Home Menu

 





How to refer to two BollingerBands in Multicharts while creating a signal?


Discussion in MultiCharts

Updated
      Top Posters
    1. looks_one ABCTG with 5 posts (3 thanks)
    2. looks_two milkysahai001 with 5 posts (0 thanks)
    3. looks_3 Chart Knight with 2 posts (0 thanks)
    4. looks_4 alex20037 with 1 posts (1 thanks)
    1. trending_up 3,218 views
    2. thumb_up 4 thanks given
    3. group 4 followers
    1. forum 11 posts
    2. attach_file 0 attachments




 
Search this Thread

How to refer to two BollingerBands in Multicharts while creating a signal?

  #1 (permalink)
milkysahai001
Agra+India
 
Posts: 42 since Sep 2016
Thanks Given: 17
Thanks Received: 3

I want to create a signal using easylanguage. I need two Bollinger Bands with 1Std Dev and 2Std Dev, but I just can't seem to write the right code for it. I would be grateful for any help. Thanks.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
REcommedations for programming help
Sierra Chart
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
33 thanks
Just another trading journal: PA, Wyckoff & Trends
26 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
19 thanks
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,627

milkysahai001,

post the code that it is giving you trouble and someone might be able to steer you in the right direction.
A good start would be to take a look at the build in Bollinger Band strategies or indicators. Then simply use the code that calls/operates the Bollinger Bands twice within your code - each with its own set of variables and inputs.

On a separate matter you might want to help @Big Mike in keeping the forum orderly by not creating double posts for the same problem :

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #3 (permalink)
 alex20037 
Miami Lakes
 
Experience: Beginner
Platform: Multicharts
Broker: Interactive Brokers
Trading: Emini ES
Posts: 19 since Oct 2016
Thanks Given: 2
Thanks Received: 3



milkysahai001 View Post
I want to create a signal using easylanguage. I need two Bollinger Bands with 1Std Dev and 2Std Dev, but I just can't seem to write the right code for it. I would be grateful for any help. Thanks.

I just used this in another post now, I think you may find the answer here:

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;

Reply With Quote
Thanked by:
  #4 (permalink)
milkysahai001
Agra+India
 
Posts: 42 since Sep 2016
Thanks Given: 17
Thanks Received: 3


ABCTG View Post
milkysahai001,

post the code that it is giving you trouble and someone might be able to steer you in the right direction.
A good start would be to take a look at the build in Bollinger Band strategies or indicators. Then simply use the code that calls/operates the Bollinger Bands twice within your code - each with its own set of variables and inputs.

On a separate matter you might want to help @Big Mike in keeping the forum orderly by not creating double posts for the same problem

Regards,

ABCTG


Hi

Below is the code:

[IntrabarOrderGeneration = False]

Inputs:
Price(Close),Length(20),
BollingerPrice(Close),TestPriceUBand(Close),TestPriceLBand(Close),NumDevsUp(2),NumDevsDn(2),
BollingerBand1(Close),TestPriceLBand1 (Close),TestPriceUBand1(Close),NumDevsUp1(1),NumDevsDn1(1); ;

Variables:
var0(0),var1(0),var2(0),var3(0);

var0 = BollingerBand(BollingerPrice, Length, -NumDevsDn);
var1 = BollingerBand(BollingerPrice, Length, NumDevsUp);
var2 = BollingerBand(BollingerPrice, Length, -NumDevsDn1);
var3 = BollingerBand(BollingerPrice, Length, NumDevsUp1);

Condition1 = CurrentBar > 1 and
TestPriceLBand crosses above var0
and TestPriceLBand1 crosses below var2
and marketposition <> 1;
if condition1 then begin
Buy ( "L" ) next bar at var1 stop ;
end;

Condition2 = CurrentBar > 1 and
TestPriceUBand crosses below var1
and TestPriceUBand1 crosses above var3
and marketposition <>-1 ;
if condition1 then begin
Sell Short ( "S" ) next bar var1 stop ;
end;

i am a beginner so please be easy on the mistakes. Thanks.

Reply With Quote
  #5 (permalink)
milkysahai001
Agra+India
 
Posts: 42 since Sep 2016
Thanks Given: 17
Thanks Received: 3


alex20037 View Post
I just used this in another post now, I think you may find the answer here:

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;

Hi

if i am not wrong, this is the default code available in multicharts. I tried to edit that to suit my purpose i.e. creating two BB but couldn't. thanks.

Reply With Quote
  #6 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,627

milkysahai001,

what is this code doing and what do you want it to do instead?

This might seem like a stupid question, but without knowing what you are trying to accomplish exactly it's hard/impossible to help you.

Regards,

ABCTG


milkysahai001 View Post
Hi

Below is the code:

[IntrabarOrderGeneration = False]

Inputs:
Price(Close),Length(20),
BollingerPrice(Close),TestPriceUBand(Close),TestPriceLBand(Close),NumDevsUp(2),NumDevsDn(2),
BollingerBand1(Close),TestPriceLBand1 (Close),TestPriceUBand1(Close),NumDevsUp1(1),NumDevsDn1(1); ;

Variables:
var0(0),var1(0),var2(0),var3(0);

var0 = BollingerBand(BollingerPrice, Length, -NumDevsDn);
var1 = BollingerBand(BollingerPrice, Length, NumDevsUp);
var2 = BollingerBand(BollingerPrice, Length, -NumDevsDn1);
var3 = BollingerBand(BollingerPrice, Length, NumDevsUp1);

Condition1 = CurrentBar > 1 and
TestPriceLBand crosses above var0
and TestPriceLBand1 crosses below var2
and marketposition <> 1;
if condition1 then begin
Buy ( "L" ) next bar at var1 stop ;
end;

Condition2 = CurrentBar > 1 and
TestPriceUBand crosses below var1
and TestPriceUBand1 crosses above var3
and marketposition <>-1 ;
if condition1 then begin
Sell Short ( "S" ) next bar var1 stop ;
end;

i am a beginner so please be easy on the mistakes. Thanks.


Follow me on Twitter Reply With Quote
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,627

milkysahai001,

think about it like this, you try to explain the exact rules that lead to an entry to someone who is not familiar with your system. After your explanation he/she should be able to trade it exactly like you do now.

The term "for trading between these ranges" might be too vague. When should the entry be triggered exactly, when would an exit be triggered etc..

TJ made some good points that are helpful in describing what a system should do in the official MC forum. Check them out, as they might help.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #8 (permalink)
milkysahai001
Agra+India
 
Posts: 42 since Sep 2016
Thanks Given: 17
Thanks Received: 3


ABCTG View Post
milkysahai001,

think about it like this, you try to explain the exact rules that lead to an entry to someone who is not familiar with your system. After your explanation he/she should be able to trade it exactly like you do now.

The term "for trading between these ranges" might be too vague. When should the entry be triggered exactly, when would an exit be triggered etc..



Regards,

ABCTG


ABCTG,

here is the system-

Indicator used:
• Bollinger Bands1: 20 pd, Std Dev: 2, -2.
• Bollinger Bands2: 20 pd, Std Dev: 1, -1.

Method:
• Long- When Close goes beyond BB1 Lower Band then go long.
• Long Exit- Stoploss-When low goes below BB2 lower band then exit long position.
• Short- When Close goes above BB1 Higher Band then go short.
• Short Exit- Stoploss- When high goes above BB2 higher band then exit short position.

this is the best explanation i can give about what i want with the system. the code is getting compiled but not giving any signals on the chart.

Reply With Quote
  #9 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,435 since Apr 2013
Thanks Given: 482
Thanks Received: 1,627

milkysahai001,

I would suggest to start with fixing your entry. Check your entry conditions. Did you write them like you want them per your description or do you maybe check that both bollinger bands have to be crossed or something else maybe?

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #10 (permalink)
Chart Knight
los angles, CA
 
Posts: 4 since Oct 2014
Thanks Given: 0
Thanks Received: 0



ABCTG View Post
milkysahai001,

what is this code doing and what do you want it to do instead?

This might seem like a stupid question, but without knowing what you are trying to accomplish exactly it's hard/impossible to help you.

Regards,

ABCTG

In both above examples, conditions starts with following:
Condition = CurrentBar > 1 and
Would someone please explain why these conditions starts with
currentBar > 1
Thanks a lot,

Reply With Quote




Last Updated on April 10, 2017


© 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