Easylanguge Multicharts Help - EasyLanguage Programming | futures io social day trading
futures io futures trading


Easylanguge Multicharts Help
Updated: Views / Replies:2,399 / 8
Created: by guppy Attachments:3

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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

Reply
 
Thread Tools Search this Thread
 

Easylanguge Multicharts Help

  #1 (permalink)
Elite Member
Los Angeles, CA
 
Futures Experience: Advanced
Platform: Tradestation
Broker/Data: Tradestation
Favorite Futures: ES,HG,GC,YM,Nq,RB,NG
 
Posts: 52 since Aug 2011
Thanks: 11 given, 8 received

Easylanguge Multicharts Help

I am having trouble implementing a stop loss in easy language. If someone can help that would be greatly appreciated. Below is the simple code. If i am short a position then i want my stop loss order to be the value of the highest high of the last 4 bars. Thats it! When i look at the results the stop order is not placed at the highest high of the last 4 bars. I also tried using 'stoplossposition' and i get an error.



vars:mystoploss(0);

mystoploss=highest(high,4)[1];


ifclose>close[1]then
begin
sellshort("SSS")1contractsnextbaratmarket;
setstoploss(mystoploss);

end;



Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 received


Try removing the SetStopLoss from the begin...end code block, something like this:
 
Code
vars: mystoploss(0);

mystoploss = Highest(high, 4)[1];

if close > close[1] then begin
    sellshort ("SSS") 1 contracts next bar at market;
end;

setstoploss(mystoploss);
Also see this post on the MC forum, and page 90 from the EasyLanguage Essentials manual.

Reply With Quote
The following user says Thank You to Jura for this post:
 
  #4 (permalink)
Elite Member
Los Angeles, CA
 
Futures Experience: Advanced
Platform: Tradestation
Broker/Data: Tradestation
Favorite Futures: ES,HG,GC,YM,Nq,RB,NG
 
Posts: 52 since Aug 2011
Thanks: 11 given, 8 received

Hi Jura,

I tired this and it still does not work. It basically just makes my stoploss the same as my entry. Please see attached picture.







Jura View Post
Try removing the SetStopLoss from the begin...end code block, something like this:
 
Code
vars: mystoploss(0);
 
mystoploss = Highest(high, 4)[1];
 
if close > close[1] then begin
    sellshort ("SSS") 1 contracts next bar at market;
end;
 
setstoploss(mystoploss);
Also see this post on the MC forum, and page 90 from the EasyLanguage Essentials manual.


Attached Thumbnails
Easylanguge Multicharts Help-stoplossnotworking.jpg  
Reply With Quote
 
  #5 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 received


guppy View Post
I tired this and it still does not work. It basically just makes my stoploss the same as my entry. Please see attached picture.

What have you tried, copy-pasting the example code? Then it would indeed not work. That's why I said:


Jura View Post
Also see this post on the MC forum, and page 90 from the EasyLanguage Essentials manual.

If you look on the page of that manual, you'll see..

Quoting 
SetStopLoss - sets a stop loss order at a fixed dollar risk from entry.
(..)
By default these exits operate on a position basis and stop amounts are set in dollars.

Now, look at the example code:
 
Code
vars: mystoploss(0);

mystoploss = Highest(high, 4)[1];

if close > close[1] then begin
    sellshort ("SSS") 1 contracts next bar at market;
end;

setstoploss(mystoploss);
The SetStopLoss is here set to the value of 'mystoploss', a variable which contains the HIGH of the instrument that you trade. Since that high will be around 1.37, judging from your screenshot, with the example code above, you will exit the position if the unrealized loss is 1.37 dollar for the whole position. Which in practice would be indeed an instantaneous exit after entry, especially if commissions are considered.

Solution: calculate the loss, in dollars for the whole position, that would happen if the position reaches the Highest(high, 4)[1]. Or alternatively, manually set the stop loss at the price of the Highest(high, 4)[1].

Reply With Quote
The following 2 users say Thank You to Jura for this post:
 
  #6 (permalink)
Elite Member
Los Angeles, CA
 
Futures Experience: Advanced
Platform: Tradestation
Broker/Data: Tradestation
Favorite Futures: ES,HG,GC,YM,Nq,RB,NG
 
Posts: 52 since Aug 2011
Thanks: 11 given, 8 received

Thanks for sharing your knowledge Jura,

I now understand that its calculated in dollar 'amount' after reading your post and links. Im surprised there isnt a simple way to setstoploss by 'price'.

Do you have any suggestions how i can do it by 'price' without having to set it manuely.




Jura View Post
What have you tried, copy-pasting the example code? Then it would indeed not work. That's why I said:



If you look on the page of that manual, you'll see..
Now, look at the example code:
 
Code
vars: mystoploss(0);
 
mystoploss = Highest(high, 4)[1];
 
if close > close[1] then begin
    sellshort ("SSS") 1 contracts next bar at market;
end;
 
setstoploss(mystoploss);
The SetStopLoss is here set to the value of 'mystoploss', a variable which contains the HIGH of the instrument that you trade. Since that high will be around 1.37, judging from your screenshot, with the example code above, you will exit the position if the unrealized loss is 1.37 dollar for the whole position. Which in practice would be indeed an instantaneous exit after entry, especially if commissions are considered.

Solution: calculate the loss, in dollars for the whole position, that would happen if the position reaches the Highest(high, 4)[1]. Or alternatively, manually set the stop loss at the price of the Highest(high, 4)[1].


Reply With Quote
The following user says Thank You to guppy for this post:
 
  #7 (permalink)
 Vendor: tradingcode.net 
The Netherlands
 
Futures Experience: None
Platform: MultiCharts, TradingView
Favorite Futures: ...
 
Jura's Avatar
 
Posts: 774 since Apr 2010
Thanks: 2,347 given, 661 received


guppy View Post
Thanks for sharing your knowledge Jura,

I now understand that its calculated in dollar 'amount' after reading your post and links. Im surprised there isnt a simple way to setstoploss by 'price'.

Do you have any suggestions how i can do it by 'price' without having to set it manuely.


You could use something like..

 
Code
vars: mystoploss(0);

mystoploss = Highest(high, 4)[1];

if close > close[1] then begin
    sellshort ("SSS") 1 contracts next bar at market;
end;

if MarketPosition = -1 then
    buytocover ("XS2") next bar at mystoploss stop;
..which submits a stoploss order at the 'mystoploss' level on every bar, as long there is a Short position (see also the first screenshot). That way you can use the price level instead of the dollar amount level.

Btw, if you look closely at the code example above, the 'mystoploss' variable is set with a new value on every bar. So, in a falling market, the value of 'mystoploss' will be lower on each update, since the Highest(high, 4) in a falling market is lower on each new bar. So, the code example above uses a trailing stop.

Good of course is that is what you intend it to do, but if you want a fixed stop-loss (that won't get updated with higher or lower Highest(High, 4)[1] values), you could use something like the following code:
 
Code
vars: mystoploss(0);

if MarketPosition = 0 and close > close[1] then begin
    mystoploss = Highest(high, 4)[1];
   sellshort ("SSS") 1 contracts next bar at market;
end;

if MarketPosition = -1 then
    buytocover ("XS2") next bar at mystoploss stop;
(See also the second attached image)

Good luck!

Attached Thumbnails
Easylanguge Multicharts Help-stoploss.png   Easylanguge Multicharts Help-fixedstoploss.png  
Reply With Quote
The following 5 users say Thank You to Jura for this post:
 
  #8 (permalink)
Elite Member
Los Angeles, CA
 
Futures Experience: Advanced
Platform: Tradestation
Broker/Data: Tradestation
Favorite Futures: ES,HG,GC,YM,Nq,RB,NG
 
Posts: 52 since Aug 2011
Thanks: 11 given, 8 received

Jura,

Your a genius! and thanks for solving the issue along with postiing images which totally helped see the problem. I originally did what your first coding showed below, but i was stumped as to why multicharts kept showing the buytocovers and all different levels. Now i realize that it was calculating and changing every bar as you clearly specified, acting more like a trailing.

The second part of the code is exacly what i was in search for. Basically a proper way of a stoploss at a fixed price! I wish the easylanguage getting started maneul and EL essentianls had these complete examples in it. Im sure it would help many people out with the basics on

1.how to implement a fixed stop loss based on price
2.how to implement a trailing stop loss based on price
3.how to implement a fixed stop loss based on dollar
4.how to implement a trailing stop loss based on dollar






Jura View Post
You could use something like..

 
Code
vars: mystoploss(0);
 
mystoploss = Highest(high, 4)[1];
 
if close > close[1] then begin
    sellshort ("SSS") 1 contracts next bar at market;
end;
 
if MarketPosition = -1 then
    buytocover ("XS2") next bar at mystoploss stop;
..which submits a stoploss order at the 'mystoploss' level on every bar, as long there is a Short position (see also the first screenshot). That way you can use the price level instead of the dollar amount level.

Btw, if you look closely at the code example above, the 'mystoploss' variable is set with a new value on every bar. So, in a falling market, the value of 'mystoploss' will be lower on each update, since the Highest(high, 4) in a falling market is lower on each new bar. So, the code example above uses a trailing stop.

Good of course is that is what you intend it to do, but if you want a fixed stop-loss (that won't get updated with higher or lower Highest(High, 4)[1] values), you could use something like the following code:
 
Code
vars: mystoploss(0);
 
if MarketPosition = 0 and close > close[1] then begin
    mystoploss = Highest(high, 4)[1];
   sellshort ("SSS") 1 contracts next bar at market;
end;
 
if MarketPosition = -1 then
    buytocover ("XS2") next bar at mystoploss stop;
(See also the second attached image)

Good luck!


Reply With Quote
The following user says Thank You to guppy for this post:
 
  #9 (permalink)
Trading Apprentice
Chicago
 
Futures Experience: Master
Platform: Tradestation, Ninja
Favorite Futures: ES CL GC 6E 6A ZB
 
Posts: 12 since Dec 2010
Thanks: 6 given, 2 received

Nice Jura

Thanks for posting that very helpful as someone who has their own strategies with trail stops :-)

Reply With Quote
The following user says Thank You to MadTr8r for this post:

Reply



futures io > > > > > Easylanguge Multicharts Help

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
MultiCharts Webinar: Peter Campbell - Systematic Trading with MultiCharts MultiCharts MultiCharts 25 August 31st, 2015 09:32 PM
NinjaTrader or Multicharts tom1 MultiCharts 113 October 7th, 2013 06:28 AM
MultiCharts, MultiCharts, MultiCharts... Big Mike MultiCharts 827 July 24th, 2011 09:44 AM
Dexter for Multicharts Locust Elite EasyLanguage Automated Trading 6 October 17th, 2010 04:24 PM
Multicharts tinkerz EasyLanguage Programming 2 May 13th, 2010 12:08 PM


All times are GMT -4. The time now is 07:21 AM.

Copyright © 2017 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
Page generated 2017-12-16 in 0.15 seconds with 20 queries on phoenix via your IP 54.226.113.250