NexusFi: Find Your Edge


Home Menu

 





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 44,745 views
    2. thumb_up 96 thanks given
    3. group 36 followers
    1. forum 42 posts
    2. attach_file 16 attachments




 
Search this Thread

VIDEO TUTORIAL: How to create an advanced MultiCharts EasyLanguage Strategy

  #21 (permalink)
bermondsey
London, UK
 
Posts: 2 since Oct 2013
Thanks Given: 1
Thanks Received: 0

hi everyone,

i've been incorporating big mike's methodology into my strategy that i am testing on tradestation. i've been trying to get my head around the following problem for the past few hours but couldn't find any solution to it:

whereas the system enters a long/short position ok, it wouldn't take into account any of the limits placed (for both stop and take profit) but would close the position at the entry price on the bar where the trade was entered.as a result the strategy is not generating any profit or loss (ignoring comms). (for additional info i'm backtesting on FGBL futures and i am using a 1min chart).

please see code below:


inputs: stopsize(8), tp (10);

vars: ticksize (minmove/pricescale), tgt1 (tp*ticksize), st1(0);


//enter position (only at the close of bar):

if barstatus(1) = 2 then begin

if marketposition = 0 and condition1 then
buy("enter long") next bar 1 contracts at close limit;

if marketposition = 0 and condition2 then
sellshort ("enter short") next bar 1 contracts at close limit;

end;


// trade management (which is causing issues):

if marketposition = 1 then
st1 = entryprice - (stopsize*ticksize);

sell ("longtarget_hit") 1 contracts next bar at (entryprice(0) + tgt1) limit;
sell ("longstop_triggered") 1 contracts next bar at st1 stop;


if marketposition = -1 then
st1 = entryprice + (stopsize*ticksize);

buytocover ("shorttarget_hit") 1 contracts next bar at (entryprice(0) - tgt1) limit;
buytocver ("shortstop_triggered") 1 contracts next bar at st1;



any help much appreciated,

cheers,

bermondsey

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Request for MACD with option to use different MAs for fa …
NinjaTrader
NexusFi Journal Challenge - April 2024
Feedback and Announcements
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
62 thanks
NexusFi site changelog and issues/problem reporting
48 thanks
Battlestations: Show us your trading desks!
36 thanks
GFIs1 1 DAX trade per day journal
32 thanks
What percentage per day is possible? [Poll]
31 thanks

  #22 (permalink)
 saj1011 
London, United Kingdom
 
Experience: Intermediate
Platform: MetaTrader
Trading: EUR/USD
Posts: 20 since Feb 2014
Thanks Given: 2
Thanks Received: 4

Big Mike says the variable "Ticksize" is not standard with MC.
I tried compiling the script and got an error highlighting that line of code of course. So, how do I get the ticksize variable in MC?

Thanks

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


saj1011,

please post the full code you are having problems with and I will try helping you.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
  #24 (permalink)
 
andby's Avatar
 andby 
Norwich, UK
 
Experience: Intermediate
Platform: Multiple:research&executi
Broker: Started with Stage5/OEC ... multiple
Trading: Anything found profitable goes ...
Posts: 167 since Jul 2012
Thanks Given: 88
Thanks Received: 88


ABCTG View Post
saj1011,

please post the full code you are having problems with and I will try helping you.

Regards,
ABCTG

Hi ABCTG,

Trying to code a simple scale-out logic in Multicharts, using a kind of different order placing mechanism.
My code looks for arrows on the chart, and whenever one is found, it enters a position according to arrow orientation and the number present within the arrow text attribute. I also need to scale out. Let's say, I enter with 3 contracts long, and I need to have 3 levels with 3 separate sell orders.
Essentially, this helps me manually place trades on history data on a chart - kind of a playback (done just by scrolling the chart to the right bar by bar) with the option of placing trades as well, and get a performance report on these "manually" entered trades.

What doesn't work:

Let's say, a long position opened on bar number 3 with code:
buy ("myOrder") 3 contracts this bar at close;
At bar 5 I sell 2 of those contracts:
sell ("myOrder") 2 contracts this bar at close;
At bar 7 I want to sell the last contract as well, basically, closing the "myOrder" position entirely:
sell ("myOrder") 1 contracts this bar at close;

However, I get the following error message in Multicharts:

"error in stuy ... "myOrder" name has already been used for the other order".

If I don't specify an order name at all, even though I sell 3 contracts across two consecutive sell orders, at the last bar, I still have MarketPosition = 1 which means position is not entirely closed, which can be seen on the graph as well (I can see the first sell order for 2 contracts, but no the second sell order for 1 contract).

Is there a workaround to this, or something I miss
?

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

andby,

you should specify different order names for each order and tie the exits to your entry. This should do what you have in mind.
 
Code
buy ("myOrder") 3 contracts this bar at close;
...
sell ("myExit1") 2 contracts from Entry ("myOrder") this bar at close;
...
sell ("myExit2") 1 contracts from Entry ("myOrder") this bar at close;
Regards,
ABCTG


andby View Post
Let's say, a long position opened on bar number 3 with code:
buy ("myOrder") 3 contracts this bar at close;
At bar 5 I sell 2 of those contracts:
sell ("myOrder") 2 contracts this bar at close;
At bar 7 I want to sell the last contract as well, basically, closing the "myOrder" position entirely:
sell ("myOrder") 1 contracts this bar at close;


Follow me on Twitter Reply With Quote
The following user says Thank You to ABCTG for this post:
  #26 (permalink)
 
andby's Avatar
 andby 
Norwich, UK
 
Experience: Intermediate
Platform: Multiple:research&executi
Broker: Started with Stage5/OEC ... multiple
Trading: Anything found profitable goes ...
Posts: 167 since Jul 2012
Thanks Given: 88
Thanks Received: 88


ABCTG View Post
andby,

you should specify different order names for each order and tie the exits to your entry. This should do what you have in mind.
 
Code
buy ("myOrder") 3 contracts this bar at close;
...
sell ("myExit1") 2 contracts from Entry ("myOrder") this bar at close;
...
sell ("myExit2") 1 contracts from Entry ("myOrder") this bar at close;
Regards,
ABCTG

ABCTG,

Thanks for a fast answer!
Uploaded the code under:



Kind Regards,
Andy

Reply With Quote
The following user says Thank You to andby for this post:
  #27 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,431 since Apr 2013
Thanks Given: 481
Thanks Received: 1,623

andby,

you are welcome, I am glad if it helped.
Thanks for sharing your code.

Regards,
ABCTG


andby View Post
ABCTG,

Thanks for a fast answer!
Uploaded the code under:



Kind Regards,
Andy


Follow me on Twitter Reply With Quote
  #28 (permalink)
 sevenofnine 
Netherlands
 
Experience: Intermediate
Platform: multicharts
Broker: Interactive Brokers
Trading: Stocks
Posts: 7 since Aug 2012
Thanks Given: 2
Thanks Received: 9


saj1011 View Post
Big Mike says the variable "Ticksize" is not standard with MC.
I tried compiling the script and got an error highlighting that line of code of course. So, how do I get the ticksize variable in MC?

Thanks

should be MinMove

Reply With Quote
  #29 (permalink)
 
spinnybobo's Avatar
 spinnybobo 
Crete, IL/USA
 
Experience: Intermediate
Platform: NinjaTrader, Mt4
Broker: Tradestation/Tradestation, NinjaTrader, FXCM and Tallinex
Trading: ES, CL, EUR/USD, TF
Posts: 173 since Aug 2009
Thanks Given: 105
Thanks Received: 61


Big Mike View Post
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


Hi Mike

thanks for this video and also for the Ninja one as they both helped me learn.
The one thing that is a little confusing for me is how different Easy Language is from Ninja in terms of setting stops and targets.
With Ninja, you just set it at the beginning. With Easy Language, it seems like you have to set them at the beginning, then again after target1 is hit, then again after target2 is hit.

So my question is will this strategy work Live? Does Easy Language automatically cancel all orders after something is filled?
Does Tradestation/Multicharts have order states like Ninja does

thanks
Spencer

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


Hi Spencer,

in Multicharts for example orders that are sent as one group like an entry with a stop and target would be treated as OCO. Once the stop or target is hit the other order would get cancelled.

Regards,
ABCTG




spinnybobo View Post
Hi Mike

thanks for this video and also for the Ninja one as they both helped me learn.
The one thing that is a little confusing for me is how different Easy Language is from Ninja in terms of setting stops and targets.
With Ninja, you just set it at the beginning. With Easy Language, it seems like you have to set them at the beginning, then again after target1 is hit, then again after target2 is hit.

So my question is will this strategy work Live? Does Easy Language automatically cancel all orders after something is filled?
Does Tradestation/Multicharts have order states like Ninja does

thanks
Spencer


Follow me on Twitter Reply With Quote





Last Updated on August 2, 2021


© 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