Easylanguage problem - MultiCharts | futures io social day trading
futures io futures trading


Easylanguage problem
Updated: Views / Replies:2,303 / 10
Created: by mengelbrecht Attachments:2

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
 2  
 
Thread Tools Search this Thread
 

Easylanguage problem

  #1 (permalink)
Elite Member
copenhagen, denmark
 
Futures Experience: Intermediate
Platform: multicharts, Ninja
Broker/Data: IB & Kinetick
Favorite Futures: ES
 
mengelbrecht's Avatar
 
Posts: 47 since Aug 2010
Thanks: 16 given, 21 received

Easylanguage problem

Hi
I have an EL problem that I hope someone can help me solve.
I am testing a strategy that trades of a line break chart and I want to go long or short if 1 of 2 conditions are met . The second part .. the else part is working fine it is the first part of the equation that I can’t get to work ??
Rule for a long position
1. IF High 2 bars back – Low 1 bar back is bigger than 10 ticks then buy …… etc else.
This is what I have
Input: Bars_back (2), Entry_distance(10)
Vars: Entry_min(0)
Variable Condition:
Entry_min = Entry_distance*ticksize
Code:
if (high[barsback] -low[1])*ticksize > entry_min then ………

what is wrong with this code ??
rgds
Mengelbrecht

Reply With Quote
 
  #2 (permalink)
Elite Member
Montreal, Canada
 
Futures Experience: Intermediate
Platform: Multicharts
Broker/Data: Interactive Broker
Favorite Futures: Forex
 
Posts: 262 since Sep 2010
Thanks: 436 given, 86 received

Hello Mengelbrecht

Don't have a direct solution for you, but maybe you could join Multicharts forum to ask. Free for owner of licence. Their is a very good support and help from these guy's.

Good luck

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



mengelbrecht View Post
Hi
I have an EL problem that I hope someone can help me solve.
I am testing a strategy that trades of a line break chart and I want to go long or short if 1 of 2 conditions are met . The second part .. the else part is working fine it is the first part of the equation that I can’t get to work ??
Rule for a long position
1. IF High 2 bars back – Low 1 bar back is bigger than 10 ticks then buy …… etc else.
This is what I have
Input: Bars_back (2), Entry_distance(10)
Vars: Entry_min(0)
Variable Condition:
Entry_min = Entry_distance*ticksize
Code:
if (high[barsback] -low[1])*ticksize > entry_min then ………

what is wrong with this code ??
rgds
Mengelbrecht

You'll need to provide more concrete information before we can really be of help here. For example, the "1 of 2 conditions" are not in the code, and the 'ticksize' variable is also undefined. Also a screenshot and the use of the [ code ] ... [ / code ] wrappers around your code would make your post easier to understand.

Reply With Quote
 
  #4 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

Hi,

After addition of some ; and definition of ticksize, the following code compiles correctly on my computer.

 
Code
Input:
    Bars_back        ( 2 ),
    Entry_distance     ( 0);

Vars:
    ticksize    ( MinMove / PriceScale ),
    Entry_min    ( 0 );

Entry_min = Entry_distance*ticksize;

if (high[Bars_back] -low[1])*ticksize > Entry_min then MessageLog("test");
Nicolas

Reply With Quote
The following user says Thank You to Nicolas11 for this post:
 
  #5 (permalink)
Elite Member
copenhagen, denmark
 
Futures Experience: Intermediate
Platform: multicharts, Ninja
Broker/Data: IB & Kinetick
Favorite Futures: ES
 
mengelbrecht's Avatar
 
Posts: 47 since Aug 2010
Thanks: 16 given, 21 received

It compiles correctly , but it doens't solve my problem - I provide more information shortly. :-)
Thx to everyone so far

rgds mengelbrecht

Reply With Quote
 
  #6 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

For our help to be more efficient, could you kindly explain precisely in your next post what your "problem" is.
I mean: what are your expecting from the code? and what is the actual result of the code (which does not satisfy you)?

Reply With Quote
 
  #7 (permalink)
Elite Member
copenhagen, denmark
 
Futures Experience: Intermediate
Platform: multicharts, Ninja
Broker/Data: IB & Kinetick
Favorite Futures: ES
 
mengelbrecht's Avatar
 
Posts: 47 since Aug 2010
Thanks: 16 given, 21 received

Hi everyone attached you'll find the EL code. The code highligted in red is causing me a problem. This system basicly takes all the trades based on the "else" conditions, so I have come to the conclution that something is wrong with the first part os the entry conditions - the 64000 $ questions is what is wrong ??

I have attached a chart that hopefully explains what I am trying to achieve.

In words I want my entry condition to look like this
Example for a short condition
1: IF the distance between high[1] and low[2] is greater than Entry_dist then sellshort at low[2] - lmt_entry stop else
sellshort at low of current bar - lmt entry stop;
Hope it makes sense

rgds
mengelbrecht

 
Code
Price( Close ), 
Barsback (2),
Cts(70000),
CTS_tgt1(70000),
TGT1(80),
Stop1 (40),
Starttrade(830),
Endtrade(1600),
dailyprofit(1200),
dailyloss(400),
LMT_entry (1),
Entry_dist (5);

Variables: var0( 0 ), var1(0), ticksize (0), targit1(0), targit2(0), Stoploss1 (0), stoploss2(0),
todaynet(0), yesterdaynet(0), priordate (date), Limit_entry (0),o1 (0), c1(0), o2(0), c2 (0), o3(0), c3(0), o4(0), c4(0), entry_min(0);
    o1 = Open of data1;
    c1 = Close of data1;
    o2 = Open[1] of data1;
    c2 = Close[1] of data1;
    o3 = Open[2] of data1;
    c3 = Close[2] of data1;
    o4 = open[3] of data1;
    c4 = Close[3] of data1;



//Varible conditions
ticksize= MinMove/PriceScale;
Limit_entry = lmt_entry*ticksize;
targit1= tgt1*ticksize;
stoploss1 = stop1*ticksize;
entry_min = Entry_dist*ticksize;

// Bar definitions
Condition1 = c1 > o1; // Current bar is up
Condition2 = c2 > o2; // one bar ago is up
Condition3 = c3 > o3; // two bars ago is up
Condition4 = c4 > o4; // three bars ago is up

Condition5 = c1 < o1; // Current bar is down
Condition6 = c2 < o2; // one bar ago is down
Condition7 = c3 < o3; // two bars ago is Down
Condition8 = c4 < o4; // Three bars ago is Down

once
    begin
    priordate = Date - 1;
    end;

if date > priordate then begin
    priordate = date;
    yesterdaynet = NetProfit;
    end;
todaynet = NetProfit + openpositionprofit - commission - yesterdaynet;

// General condition
condition99 = (-dailyloss < todaynet and todaynet < dailyprofit) and (Time > starttrade and time < endtrade);


/// Entry long
If condition99 then begin
if (high[barsback] -low[1])*ticksize > entry_min and condition5 then buy ("buy1") cts contracts next bar at (low[barsback] + Limit_entry) stop else
if (high[barsback] -low[1])*ticksize < entry_min and condition1 and condition6 then buy ("buy2") cts contracts next bar at (high + Limit_entry) stop;
end;
/// Entry Short
If condition99 then begin
if (high[1]-low[barsback] )*ticksize > entry_min and condition1 then sellshort ("sell1") cts contracts next bar at (high[barsback] - Limit_entry) stop else
if (high[1]-low[barsback] )*ticksize < entry_min and condition5 and condition2 then sellshort ("sell2") cts contracts next bar at (low - Limit_entry) stop;
end;

//Moneymanagement
if marketposition = 1 then begin
If currentcontracts = Cts then sell ("LONG_TGT1") CTS_tgt1 contracts next bar at (openentryprice + targit1) limit;
end;
if marketposition = -1 then begin
If currentcontracts = Cts then buytocover ("Short_TGT1") CTS_tgt1 contracts next bar at (openentryprice - targit1) limit;
end;


//exit on close
If marketposition = 1 then begin
if currentcontracts = CTS and time > endtrade then sell ("LX_Close1") cts contracts next bar at market;
if currentcontracts = (CTS-CTS_tgt1) and time > endtrade then sell ("LX_Close2") (CTS-CTS_tgt1)contracts next bar at market;
end;
If marketposition = -1 then begin
if currentcontracts = CTS and time > endtrade then buytocover ("SX_Close1") cts contracts next bar at market;
if currentcontracts = (CTS-CTS_tgt1) and time > endtrade then buytocover ("SX_Close2") (CTS-CTS_tgt1)contracts next bar at market;
end;

// Exit on Todaynet
If marketposition = 1 then begin
if currentcontracts = CTS and (todaynet > dailyprofit or todaynet < -dailyloss ) then sell ("Pos_LX_close1") cts contracts this bar at close;
if currentcontracts = (CTS-CTS_tgt1) and (todaynet > dailyprofit or todaynet < -dailyloss ) then sell ("Pos_LX_close2") (CTS-CTS_tgt1) contracts this bar at close;
end;
If marketposition = -1 then begin
if currentcontracts = CTS and (todaynet > dailyprofit or todaynet < -dailyloss ) then buytocover ("Pos_SX_close1") cts contracts this bar at close;
if currentcontracts = (CTS-CTS_tgt1) and (todaynet > dailyprofit or todaynet < -dailyloss ) then buytocover ("Pos_SX_close2") (CTS-CTS_tgt1) contracts this bar at close;
end;

// StopLoss
If  MarketPosition = 1  Then begin
If  CurrentContracts = Cts then sell ("Long_stoploss1") cts contracts next bar at (openentryprice - Stoploss1) stop ;
If  CurrentContracts = (CTS-CTS_tgt1) then sell ("Long_stoploss2") (CTS-CTS_tgt1) contracts next bar at (openentryprice - Stoploss1) stop ;
end;
If  MarketPosition = -1 Then begin
If  CurrentContracts = Cts then buytocover ("short_stoploss1") cts contracts next bar at (openentryprice + Stoploss1) stop ;
If  CurrentContracts = (CTS-CTS_tgt1)then buytocover ("short_stoploss2") (CTS-CTS_tgt1) contracts next bar at (openentryprice + Stoploss1) stop ;
end;

Attached Thumbnails
Easylanguage problem-el_problem1.jpg  
Reply With Quote
 
  #8 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received

Answer
This post has been selected as an answer to the original posters question Answer

I fear that there is a problem in units.

"entry_min = Entry_dist*ticksize;"
means that:
  • Entry_dist shall be expressed in ticks: is it the case?
  • ticksize shall be in $ per tick, which is the case
  • entry_min is in $ (not in ticks): is it what you want?
"(high[1]-low[barsback] )*ticksize" is wrong, since $ is multiplied by $.
If you want $, just write "high[1]-low[barsback]".
If you want ticks, you have to divide by ticksize: "(high[1]-low[barsback] ) / ticksize"

Nicolas

Reply With Quote
The following user says Thank You to Nicolas11 for this post:
 
  #9 (permalink)
Elite Member
copenhagen, denmark
 
Futures Experience: Intermediate
Platform: multicharts, Ninja
Broker/Data: IB & Kinetick
Favorite Futures: ES
 
mengelbrecht's Avatar
 
Posts: 47 since Aug 2010
Thanks: 16 given, 21 received

Hi Nicholas
a HUUUGE thank you for your input
- I have changed the code see below - changed from multiply to devide :-).
All trades is now done based on the first rule - no validation seems to take place - see attached screenshot. The arrow point to an entry that should been based on the second (else) rule.

 
Code
/// Entry long
If condition99 then begin
if (high[barsback] -low[1])/ticksize > entry_min and condition5 then buy ("buy1") cts contracts next bar at (low[barsback] + Limit_entry) stop else
if (high[barsback] -low[1])/ticksize < entry_min and condition1 and condition6 then buy ("buy2") cts contracts next bar at (high + Limit_entry) stop;
end;
/// Entry Short
If condition99 then begin
if (high[1]-low[barsback] )/ticksize > entry_min and condition1 then sellshort ("sell1") cts contracts next bar at (high[barsback] - Limit_entry) stop else
if (high[1]-low[barsback] )/ticksize < entry_min and condition5 and condition2 then sellshort ("sell2") cts contracts next bar at (low - Limit_entry) stop;
end;

Attached Thumbnails
Easylanguage problem-el_problem2.jpg  
Reply With Quote
 
  #10 (permalink)
Elite Member
near Paris, France
 
Futures Experience: Beginner
Platform: -
Favorite Futures: -
 
Nicolas11's Avatar
 
Posts: 1,070 since Aug 2011
Thanks: 2,232 given, 1,729 received


You're welcome.

But take care, there might still be an issue:
(high[barsback] -low[1])/ticksize > entry_min
Left size of the inequality is in ticks
Right size of the inequality is in $ (if entry_min is still defined by "Entry_min = Entry_distance*ticksize;")

This is not consistent.

Nicolas

Reply With Quote
The following 2 users say Thank You to Nicolas11 for this post:

Reply



futures io > > > > Easylanguage problem

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
EasyLanguage and Excel - An Example ericbrown EasyLanguage Programming 3 January 31st, 2013 05:33 PM
MACD EasyLanguage help energetic EasyLanguage Programming 3 August 22nd, 2011 03:07 PM
Easylanguage : Decimal problem Ozons EasyLanguage Programming 3 February 13th, 2011 01:28 AM
Easylanguage vs. C++ Cogito ergo sum EasyLanguage Programming 10 August 2nd, 2010 03:12 PM


All times are GMT -4. The time now is 10:43 PM.

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-13 in 0.14 seconds with 40 queries on phoenix via your IP 54.226.113.250