NexusFi: Find Your Edge


Home Menu

 





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 7,243 views
    2. thumb_up 5 thanks given
    3. group 3 followers
    1. forum 14 posts
    2. attach_file 0 attachments




 
Search this Thread
  #11 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

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 X Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Trump Media to sell instant access to market-moving soci …
Traders Hideout
EA
Platforms and Indicators
No book, only a stair: journaling fills where price move …
Cryptocurrency
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
My Rant with AMP Futures
Trading Reviews and Vendors
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Mes vs MNQ
6 thanks
NexusFi site changelog and issues/problem reporting
5 thanks
BERN ALGOS algo trading journal
3 thanks
Johnnys Journal
2 thanks
TopStep Trader disappointment
2 thanks
  #12 (permalink)
jjsshh
Helsinki, Finland
 
Posts: 23 since Dec 2013
Thanks Given: 14
Thanks Received: 4

Ok,

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


Reply With Quote
  #13 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643


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 X Reply With Quote
  #14 (permalink)
jjsshh
Helsinki, Finland
 
Posts: 23 since Dec 2013
Thanks Given: 14
Thanks Received: 4

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
  #15 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,643

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




Last Updated on August 5, 2014


© 2026 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 - Downloads - Top
no new posts