VIDEO TUTORIAL: How to create an advanced MultiCharts EasyLanguage Strategy - futures io
futures io



VIDEO TUTORIAL: How to create an advanced MultiCharts EasyLanguage Strategy


Discussion in MultiCharts

Updated
      Top Posters
    1. looks_one ABCTG with 7 posts (3 thanks)
    2. looks_two Big Mike with 6 posts (82 thanks)
    3. looks_3 andby with 3 posts (1 thanks)
    4. looks_4 Lampert with 2 posts (7 thanks)
      Best Posters
    1. looks_one Big Mike with 13.7 thanks per post
    2. looks_two Lampert with 3.5 thanks per post
    3. looks_3 Family Trader with 2 thanks per post
    4. looks_4 ABCTG with 0.4 thanks per post
    1. trending_up 36,040 views
    2. thumb_up 96 thanks given
    3. group 35 followers
    1. forum 42 posts
    2. attach_file 16 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
 

VIDEO TUTORIAL: How to create an advanced MultiCharts EasyLanguage Strategy

(login for full post details)
  #1 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,150 since Jun 2009
Thanks: 32,655 given, 99,065 received

Last year I did a video tutorial on creating an advanced NinjaTrader strategy, and you guys liked it. So I thought that since I don't use NT any more it would be a good idea to do the same strategy as an example in EasyLanguage with MultiCharts.

First, here is a link to the NinjaTrader Video Tutorial:


OK, so in this video I show you how to create a strategy with optimizable parameters such as SMA length, EMA length, HMA length, three different targets, a stop, and the option to move target 2 to breakeven after target 1 is hit, as well as an option to move target 3 to breakeven after target 2 is hit.



Remember, this strategy is just an example! It took only a few minutes to write, and even though it shows to be profitable - it isn't (it won't be). Simple strategies are usually best to avoid curve fitting, but this one is too simple to actually work fully automated. A good strategy may take dozens of hours to create.

This example was created just so you could get your feet wet and learn some of the basics of strategy creation in MultiCharts or EasyLanguage.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
Running two strategies on one chart; Has anyone done it …
MultiCharts
Pause calculation When Position is Open-Backtesting
ThinkOrSwim
Mack + Order Flow
Emini and Emicro Index
2003 Nymex Symposium
Traders Hideout
Simple code to end my indicator
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Spoo-nalysis ES e-mini futures S&P 500
54 thanks
Are you sure that your broker cant spy your trades and w …
19 thanks
Want your NinjaTrader indicator created, free?
15 thanks
Would you share your Holy Grail?
15 thanks
Big Mike in Ecuador
14 thanks
 
(login for full post details)
  #2 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,150 since Jun 2009
Thanks: 32,655 given, 99,065 received

Here is the code for jtHMA function if you need it:

 
Code
                            


{jtHMA Hull Moving Average Function}
{
AuthorAtavachron}
{
May 2005}

Inputsprice(NumericSeries), length(NumericSimple);
VarshalvedLength(0), sqrRootLength(0);

{
Original equation is:
---------------------
waverage(2*waverage(close,period/2)-waverage(close ,period), SquareRoot(Period)
Implementation below is more efficient with lengthy Weighted Moving Averages.
In additionthe length needs to be converted to an integer value after it is halved and
its square root is obtained in order for this to work with Weighted Moving Averaging
}

if ((
ceiling(length 2) - (length 2)) <= 0.5then
halvedLength 
ceiling(length 2)
else
halvedLength floor(length 2);

if ((
ceiling(SquareRoot(length)) - SquareRoot(length)) <= 0.5then
sqrRootLength 
ceiling(SquareRoot(length))
else
sqrRootLength floor(SquareRoot(length));

Value1 WAverage(pricehalvedLength);
Value2 WAverage(pricelength);
Value3 WAverage((Value1 Value2), sqrRootLength);

jtHMA Value3
Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
The following 8 users say Thank You to Big Mike for this post:
 
(login for full post details)
  #3 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,150 since Jun 2009
Thanks: 32,655 given, 99,065 received


Here is the code for the strategy created in our video example. I've also attached a MultiCharts pla to make it easy for importing, and that pla also contains the jtHMA function (since HMA is not built-in to MultiCharts).

 
Code
                            


{
Big Mike Trading https://futures.io
June 2011
}


inputs:
    
smalength 200 ),
    
emalength 100 ),
    
hmalength 34 ),
    
target1 12 ),
    
target2 12 ),
    
target3 20 ),
    
stopsize 12 ),
    
BE2 ), // 0=false, 1=true
    
BE3 ); // 0=false, 1=true
    
vars:
    
TickSize    MinMove PriceScale ),
    
smav        ),
    
emav        ),
    
hmav        ),
    
t1        Target1 TickSize ),
    
t2        ( (Target1 Target2) * TickSize ),
    
t3        ( (Target1 Target2 Target3) * TickSize ),
    
st1        ),
    
st2        ),
    
st3        );
    
smav Average(Closesmalength);
emav XAverage(Closeemalength);
hmav jtHMA(Closehmalength);


// open new positions

if MarketPosition 0 then begin

    
if smav smav[1] and emav emav[1] and hmav hmav[1then begin
    
        Buy 
("Enter long"3 Contracts Next Bar At Market;
    
    
end

    if 
smav smav[1] and emav emav[1] and hmav hmav[1then begin
    
        SellShort 
("Enter short"3 Contracts Next Bar At Market;
    
    
end
end;

// manage open orders

if MarketPosition 1 then begin

    st1 
EntryPrice - (stopsize TickSize);
    
st2 iff(BE2 1EntryPriceEntryPrice - (stopsize TickSize));
    
st3 iff(BE3 1EntryPriceEntryPrice - (stopsize TickSize));
    
    if 
CurrentContracts 1 then begin
        Sell 
("Exit l3-c1 Target"1 Contracts Next Bar At (EntryPrice t3Limit;
        
Sell ("Exit l3-c1 Stop"1 Contracts Next Bar At st3 Stop;
    
end;

    if 
CurrentContracts 2 then begin
        Sell 
("Exit l2-c2 Target"1 Contracts Next Bar At (EntryPrice t2Limit;
        
Sell ("Exit l2-c2 Stop"1 Contracts Next Bar At st2 Stop;
        
Sell ("Exit l3-c2 Target"1 Contracts Next Bar At (EntryPrice t3Limit;
        
Sell ("Exit l3-c2 Stop"1 Contracts Next Bar At st3 Stop;
    
end;
    
    if 
CurrentContracts 3 then begin
        Sell 
("Exit l1-c3 Target"1 Contracts Next Bar At (EntryPrice t1Limit;
        
Sell ("Exit l1-c3 Stop"1 Contracts Next Bar At st1 Stop;
        
Sell ("Exit l2-c3 Target"1 Contracts Next Bar At (EntryPrice t2Limit;
        
Sell ("Exit l2-c3 Stop"1 Contracts Next Bar At st2 Stop;
        
Sell ("Exit l3-c3 Target"1 Contracts Next Bar At (EntryPrice t3Limit;
        
Sell ("Exit l3-c3 Stop"1 Contracts Next Bar At st3 Stop;
    
end;
end;

if 
MarketPosition = -1 then begin

    st1 
EntryPrice + (stopsize TickSize);
    
st2 iff(BE2 1EntryPriceEntryPrice + (stopsize TickSize));
    
st3 iff(BE3 1EntryPriceEntryPrice + (stopsize TickSize));
    
    if 
CurrentContracts 1 then begin
        BuyToCover 
("Exit s3-c1 Target"1 Contracts Next Bar At (EntryPrice t3Limit;
        
BuyToCover ("Exit s3-c1 Stop"1 Contracts Next Bar At st3 Stop;
    
end;

    if 
CurrentContracts 2 then begin
        BuyToCover 
("Exit s2-c2 Target"1 Contracts Next Bar At (EntryPrice t2Limit;
        
BuyToCover ("Exit s2-c2 Stop"1 Contracts Next Bar At st2 Stop;
        
BuyToCover ("Exit s3-c2 Target"1 Contracts Next Bar At (EntryPrice t3Limit;
        
BuyToCover ("Exit s3-c2 Stop"1 Contracts Next Bar At st3 Stop;
    
end;
    
    if 
CurrentContracts 3 then begin
        BuyToCover 
("Exit s1-c3 Target"1 Contracts Next Bar At (EntryPrice t1Limit;
        
BuyToCover ("Exit s1-c3 Stop"1 Contracts Next Bar At st1 Stop;
        
BuyToCover ("Exit s2-c3 Target"1 Contracts Next Bar At (EntryPrice t2Limit;
        
BuyToCover ("Exit s2-c3 Stop"1 Contracts Next Bar At st2 Stop;
        
BuyToCover ("Exit s3-c3 Target"1 Contracts Next Bar At (EntryPrice t3Limit;
        
BuyToCover ("Exit s3-c3 Stop"1 Contracts Next Bar At st3 Stop;
    
end;
    
end
Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Attached Files
Register to download File Type: pla BMT_MoneyMaker.pla (13.4 KB, 319 views)
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
The following 17 users say Thank You to Big Mike for this post:
 
(login for full post details)
  #4 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,150 since Jun 2009
Thanks: 32,655 given, 99,065 received

Here is a follow-up. This is a 1-year backtest on the EUR/USD, 6 range chart, with $2 commission per side and $12.50 slippage per contract.

Results came back with 28k net profit on 2,159 trades, 40% win rate, w/l ratio of 1.56. However, when you look at the equity curve and other performance metrics, you'll see this strategy needs work. As expected. This video was just an example, you could use it as a starting point.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Attached Thumbnails
Click image for larger version

Name:	6-4-2011 4-15-15 PM.png
Views:	444
Size:	224.9 KB
ID:	40201   Click image for larger version

Name:	6-4-2011 4-17-11 PM.png
Views:	419
Size:	21.3 KB
ID:	40202   Click image for larger version

Name:	6-4-2011 4-18-12 PM.png
Views:	542
Size:	158.0 KB
ID:	40203   Click image for larger version

Name:	6-4-2011 4-18-59 PM.png
Views:	455
Size:	50.1 KB
ID:	40204   Click image for larger version

Name:	6-4-2011 4-19-55 PM.png
Views:	420
Size:	11.3 KB
ID:	40205   Click image for larger version

Name:	6-4-2011 4-20-05 PM.png
Views:	454
Size:	17.4 KB
ID:	40206   Click image for larger version

Name:	6-4-2011 4-20-19 PM.png
Views:	376
Size:	27.2 KB
ID:	40207   Click image for larger version

Name:	6-4-2011 4-21-27 PM.png
Views:	392
Size:	77.8 KB
ID:	40208  
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
The following 12 users say Thank You to Big Mike for this post:
 
(login for full post details)
  #5 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
 
Big Mike's Avatar
 
Posts: 50,150 since Jun 2009
Thanks: 32,655 given, 99,065 received

Feel free to make a request for future video tutorials in this thread.

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Started this thread Reply With Quote
The following 2 users say Thank You to Big Mike for this post:
 
(login for full post details)
  #6 (permalink)
 Family Trader 
Palm Beach County
 
Experience: Advanced
Platform: OEC about to change to Ninja
Trading: ES ,EUR/USD
 
Posts: 179 since Feb 2011
Thanks: 66 given, 90 received

Thank you for the presentation....very useful to a 'dumb techy' like me...worth a laugh when you apologized for having to type 'slow'...in comparison to the Ninja video where I had to hit the "pause" button a million times to follow what you were doing.

Hope your hand/wrist are healing well..

Trader

Visit my futures io Trade Journal Reply With Quote
The following 2 users say Thank You to Family Trader for this post:
 
(login for full post details)
  #7 (permalink)
 steelchueh 
Taipei/Taiwan
 
Experience: Beginner
Platform: Multicharts/NinjaTrader
Broker: AMP/CQG
Trading: ES
 
Posts: 42 since Oct 2011
Thanks: 139 given, 25 received


Big Mike View Post
Here is a follow-up. This is a 1-year backtest on the EUR/USD, 6 range chart, with $2 commission per side and $12.50 slippage per contract.

Results came back with 28k net profit on 2,159 trades, 40% win rate, w/l ratio of 1.56. However, when you look at the equity curve and other performance metrics, you'll see this strategy needs work. As expected. This video was just an example, you could use it as a starting point.

Mike

Very good to show me for the multiple contracts control in the MC..
Well, the MDD seems quite huge... for such strategy...
Thanks for your sharing, anyway,, I learned a lot!!
Wish for sharing more MC coding examples...

-Steel

Reply With Quote
 
(login for full post details)
  #8 (permalink)
erchis
Plzeň
 
 
Posts: 3 since May 2012
Thanks: 0 given, 0 received

Hi Big Mike,
could you help me please with writing this simple strategy in EasyLanguage?

Strategy:

Indicators - EMA(x), SMA(y), MACD(m,n,o), CCI(p); where x<y

Our pozition is everytime e.g. 5 % of 100000$ - initial capital.

Bull's position:

Signal for entry- EMA(x) crosses up SMA(y), where x<y, and MACD>=0 ∧ CCI>=0

Moment of entry - closing price of the candle, in which crossover hapend

STOPLOSS - minimum of the candle, which is the lowest in recent x days, where x is EMA's period, (I think it is called SWING LOW) and it moves with time

PROFIT TARGET - is in the same distance like STOPLOSSE every time and when we achieve it, we close half amount of our position

Signal for exit- EMA(x) crosses down SMA(y), where x<y, in this moment we sell the second half of position or whole position in that case we didn't achieve PROFIT TARGET yet.

Bear's position
the rules are same but vice versa


That's it and I have also one suggestion for next video tutorial - how backtest portfolio in MultiCHarts

Thank you for any help
and I'm sorry for my bad English

Reply With Quote
 
(login for full post details)
  #9 (permalink)
erchis
Plzeň
 
 
Posts: 3 since May 2012
Thanks: 0 given, 0 received

Hi,
I wrote some code according to the video and my trading rules above and tried it
on day chart of google, but it doesn't make any trades...is the algorithm correct?

Thanks very much

CODE:
---------------------------------------------------------------------------------------------------------------
inputs:

smalength ( 26 ),

emalength ( 8 ),

macdfastlength ( 5 ),

macdslowlength ( 10 ),

ccilength (14);



vars:

TickSize ( MinMove / PriceScale ),

smav ( 0 ),

emav ( 0 ),

macdv ( 0 ),

cciv ( 0 ),

money ( 70000 ),

stocks ( Close/money ),

tar ( 0 ),

st ( Close ),

timer ( 0 );



smav = Average(Close, smalength);

emav = XAverage(Close, emalength);

macdv = MACD(Close, macdfastlength , macdslowlength);

cciv = CCI(ccilength);


// open new positions


if MarketPosition = 0 then begin


if emav crosses over smav then begin
alert("prekrizeni nahoru");
if macdv >= 0 and cciv >= 0 then begin


Buy ("Enter long") stocks Contracts Next Bar At Market;

end;

end;


if emav crosses under smav then begin

if macdv < 0 and cciv < 0 then begin


SellShort ("Enter short") stocks Contracts Next Bar At Market;

end;

end;
end;

// manage open orders


if MarketPosition = 1 then begin // 1 - means long position opened

for timer = 0 to emalength - 1 begin
if st > Close[timer] then begin
st = Close[timer]; // stoploss on the swing low
end;
end ;
tar = Close + (Close - st);


Sell ("Exit long Target") stocks/2 Contracts Next Bar At tar Limit;

Sell ("Exit long Stop") currentcontracts Contracts Next Bar At st Stop;

end;



if MarketPosition = -1 then begin // -1 - means short position opened

for timer = 0 to emalength - 1 begin
if st < Close[timer] then begin
st = Close[timer]; // stoploss on the swing high
end;
end ;
tar = Close - (st - Close);



BuyToCover ("Exit short Target") stocks/2 Contracts Next Bar At tar Limit;

BuyToCover ("Exit short Stop") currentcontracts Contracts Next Bar At st Stop;

end;

Reply With Quote
 
(login for full post details)
  #10 (permalink)
 guppy 
Los Angeles, CA
 
Experience: Advanced
Platform: Tradestation
Broker: Tradestation
Trading: ES,HG,GC,YM,Nq,RB,NG
 
Posts: 52 since Aug 2011
Thanks: 11 given, 8 received


Hi Mike,

In your example, what if your profit or stop loss gets hit on the entry bar. How can you make it so that it will exit on the entry bar and not on the next bar?




Big Mike View Post
Here is a follow-up. This is a 1-year backtest on the EUR/USD, 6 range chart, with $2 commission per side and $12.50 slippage per contract.

Results came back with 28k net profit on 2,159 trades, 40% win rate, w/l ratio of 1.56. However, when you look at the equity curve and other performance metrics, you'll see this strategy needs work. As expected. This video was just an example, you could use it as a starting point.

Mike


Reply With Quote


futures io Trading Community Platforms and Indicators MultiCharts > VIDEO TUTORIAL: How to create an advanced MultiCharts EasyLanguage Strategy


Last Updated on August 2, 2021


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), 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