Easylanguage help needed, from signal to function - futures io
futures io futures trading



Easylanguage help needed, from signal to function


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one jjsshh with 7 posts (0 thanks)
    2. looks_two ABCTG with 6 posts (3 thanks)
    3. looks_3 wldman with 1 posts (2 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 2,219 views
    2. thumb_up 5 thanks given
    3. group 3 followers
    1. forum 14 posts
    2. attach_file 0 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
 

Easylanguage help needed, from signal to function

(login for full post details)
  #1 (permalink)
Helsinki, Finland
 
 
Posts: 23 since Dec 2013
Thanks: 14 given, 4 received

Hi,

i'm having hard time by trying to change ela signals reserved words to a form which can be used inside a function. For example how to change barssinceentry or a beginprice to a form that can be used in a function. The mission is to plot the signal with indicator by using a function form of signal. For example, if long then indicator is 1.. Thanks in advance!

Reply With Quote

Journal Challenge February 2021 results:
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(173 thanks from 31 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(120 thanks from 33 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(35 thanks from 17 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 
 
(login for full post details)
  #3 (permalink)
Market Wizard
Chicago Illinois USA
 
Experience: Advanced
Broker: IB, ToS
Trading: /ES, US Equities/Options
 
wldman's Avatar
 
Posts: 3,341 since Aug 2011
Thanks: 1,978 given, 8,830 received


there is a thread for that. I s something like "Want your easylanguage...for free". You should try there instead of making a new thred that is personal to just you. LOTS of VERY keen advice available in that thread.

Visit my futures io Trade Journal Reply With Quote
The following 2 users say Thank You to wldman for this post:
 
(login for full post details)
  #4 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received

jjsshh,

what are you trying to accomplish with that function? Your code uses several reserved words that are only available in signals. On top of that orders can't be send from functions. For any one to be able to help you need to elaborate more on what the result should be in my opinion.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
The following 2 users say Thank You to ABCTG for this post:
 
(login for full post details)
  #5 (permalink)
Helsinki, Finland
 
 
Posts: 23 since Dec 2013
Thanks: 14 given, 4 received

wldman got the point, the first post was stupid and I will change it.

ABCTG I'm trying to plot it via indicator.

Reply With Quote
 
(login for full post details)
  #6 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received


jjsshh View Post
ABCTG I'm trying to plot it via indicator.

jjsshh,

what exactly are you trying to plot? It's probably perfectly clear for you what you want, but a second person might
have a hard time understanding what you want when you only provide limited information.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #7 (permalink)
Helsinki, Finland
 
 
Posts: 23 since Dec 2013
Thanks: 14 given, 4 received

ABCTG i'm trying to plot the signal with indicator which uses function. For example if signal is long then the indicator is 1 and when out of the markets indicator is 0. And yes, the problem is with those reserved words.

Reply With Quote
 
(login for full post details)
  #8 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received

If you could post the code again I will see if I can help you a bit (wrap code tags around it, so it's better to distinguish from the text).
In general you need a variable that keeps track of the changes in the marketposition. You will also need variables keeping tracks of your stops and prices where you'd enter. You can also post the code you already have done so far and I'll try to steer you into the right direction.

Regards,
ABCTG


jjsshh View Post
ABCTG i'm trying to plot the signal with indicator which uses function. For example if signal is long then the indicator is 1 and when out of the markets indicator is 0. And yes, the problem is with those reserved words.


Follow me on Twitter Reply With Quote
 
(login for full post details)
  #9 (permalink)
Helsinki, Finland
 
 
Posts: 23 since Dec 2013
Thanks: 14 given, 4 received

Here is the code. as said entcondl and entconds are true/false vars and MMStop, targfr and avetr are inputs.
///////////////////////////////////////////////////////////////


{ Entry orders }
If MarketPosition = 0 and EntCondL then begin
Buy next bar at market;
end;

If MarketPosition = 0 and EntCondS and EntCondL = false then begin
Sell short next bar at market;
end;

{ Exit orders, long trades }
If MarketPosition = 1 then begin
If BarsSinceEntry = 0 then begin
LStop = (1 - MMStopPct/100.0) * EntryPrice;
end;

Sell("ExStop-L") next bar at LStop stop;

TargPrL = EntryPrice + TargFr * AveTR;
Sell("ExTarg-L") next bar at TargPrL limit;
end;

{ Exit orders, short trades }
If MarketPosition = -1 then begin
If BarsSinceEntry = 0 then begin
SStop = (1 + MMStopPct/100.0) * EntryPrice;
end;

Buy to cover("ExStop-S") next bar at SStop stop;

TargPrS = EntryPrice - TargFr * AveTR;
Buy to cover("ExTarg-S") next bar at TargPrS limit;
end;

Reply With Quote
 
(login for full post details)
  #10 (permalink)
Helsinki, Finland
 
 
Posts: 23 since Dec 2013
Thanks: 14 given, 4 received


This is what i have tried. It doesn't work at all. Indicatvalue is the name of function and is used via indicator.


///////////////////////////

switch(mpos)
begin

case 0:
if entcondl then begin
Lstop = (1-MMstoppct/100)*Open;
TargPrl = Open*TargFr*AveTR;
mpos=1;
end;


if entcondl=false and entconds then begin

mpos=-1;
SStop = (1 + MMStopPct/100.0) * open;
TargPrS = open - TargFr * AveTR;
end;

end;

case 1:
if close<= Lstop or close>= targprl then mpos=0;

case -1:
if close>=Sstop or close<=targprs then mpos=0;

end;

indicatvalue = mpos;

Reply With Quote
 
(login for full post details)
  #11 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received

jjsshh,

as far as I know you can't use conditions within a switch/case expression.
This is how I would start, using flags to set the marketposition. These flags will become true when your entry conditions are met. On the next bar the variable MyMarketPosition would receive the status of the position. This will ensure that the value for MyMarketPosition is aligned with the position of your signal (as you are using orders for the next bar).

This should give you a foundation to work on the exit part.

Regards,
ABCTG

 
Code
Variables:
	GoLong			( false ),
	GoShort		( false ),
	EntCondL 		( false ),
	EntCondS 		( false ),
	MyEntryBar		( 0 ),
	MyMarketPosition	( 0 );

//set long market position and store entry barnumber
if GoLong then
begin
	MyMarketPosition = + 1 ;
	GoLong = false ;
	MyEntryBar = CurrentBar ;
end ;

//set short market position and store entry barnumber
if GoShort then
begin
	MyMarketPosition = - 1 ;
	GoShort = false ;
	MyEntryBar = CurrentBar ;
end ;
	
{ Entry orders }
If MyMarketPosition = 0 and EntCondL then 
	GoLong = true ;

If MyMarketPosition = 0 and EntCondS and EntCondL = false then
	GoShort = true ;

Follow me on Twitter Reply With Quote
The following user says Thank You to ABCTG for this post:
 
(login for full post details)
  #12 (permalink)
Helsinki, Finland
 
 
Posts: 23 since Dec 2013
Thanks: 14 given, 4 received

Ok,

and thanks. The problem may be due to a switch/case. I will try make exits on my own.

Reply With Quote
 
(login for full post details)
  #13 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received

jjsshh,

did you succeed with the exits?

Regards,
ABCTG


jjsshh View Post
Ok,

and thanks. The problem may be due to a switch/case. I will try make exits on my own.


Follow me on Twitter Reply With Quote
 
(login for full post details)
  #14 (permalink)
Helsinki, Finland
 
 
Posts: 23 since Dec 2013
Thanks: 14 given, 4 received

No, i have tried several solutions, but none of them is working. How do you handle the open price which is used in stops? Do you store it in GoLong or Goshort condition?

Reply With Quote
 
(login for full post details)
  #15 (permalink)
 
 
Posts: 2,230 since Apr 2013
Thanks: 409 given, 1,471 received

jjsshh,

yes, so it's the open of the bar where the marketposition is changed. Which would be the entry bar.

Regards,
ABCTG


jjsshh View Post
No, i have tried several solutions, but none of them is working. How do you handle the open price which is used in stops? Do you store it in GoLong or Goshort condition?


Follow me on Twitter Reply With Quote


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Easylanguage help needed, from signal to function


Last Updated on August 5, 2014


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
 

Call Option Buying: The New Pain Trade? w/Carley Garner

Elite only
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

New Challenge (TBD)

April
     



Copyright © 2021 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