NexusFi: Find Your Edge


Home Menu

 





Way to Execute Something *Once,* Then Move On?


Discussion in EasyLanguage Programming

Updated
    1. trending_up 6,569 views
    2. thumb_up 4 thanks given
    3. group 2 followers
    1. forum 12 posts
    2. attach_file 0 attachments




 
Search this Thread
  #11 (permalink)
djvie11
Chicago, IL
 
Posts: 52 since Jul 2013
Thanks Given: 29
Thanks Received: 1

Thank you very much for that idea, Chris! And for those interested, info about the "Once" Reserved word is on page 861 of this PDF:

https://uploads.tradestation.com:443/uploads/EasyLanguage-Functions-and-Reserved-Words-Reference.pdf



ABCTG View Post
If you actually only want to do it once and not once per trade, you could also look at the reserved word "once" or simply initialize your variable with the reset value. However from your code it looks more like you are trying to track the high while you are in a position, which will likely mean you want to reset the variable at the beginning of every trade.

Regards,

ABCTG


Reply With Quote
  #12 (permalink)
djvie11
Chicago, IL
 
Posts: 52 since Jul 2013
Thanks Given: 29
Thanks Received: 1

I suppose the downside of this is that it will literally only run the script once. I verified this via the Print function.

I was hoping that when MarketPosition switched back from 0/1/-1 it would "reset" the once and run it again. I'll report back if I figure out a fix (I.e went the MarketPosition went from 0 to 1; Run script once. Then went it went back to 0 again it would essentially reset the once command so when it went from 0 to 1 again (or -1) it would run again.

 
Code
IF MarketPosition = 1  THEN ONCE Reset; 
  
IF MarketPosition = -1 THEN ONCE Reset ;


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

Hi Brandon,

yes, that's why I suggested it might not be suitable for your approach as you can not reset the once.

Did you test the code snippet I posted using print statements? What results did you get?

Regards,

ABCTG


djvie11 View Post
I suppose the downside of this is that it will literally only run the script once. I verified this via the Print function.

I was hoping that when MarketPosition switched back from 0/1/-1 it would "reset" the once and run it again. I'll report back if I figure out a fix (I.e went the MarketPosition went from 0 to 1; Run script once. Then went it went back to 0 again it would essentially reset the once command so when it went from 0 to 1 again (or -1) it would run again.

 
Code
IF MarketPosition = 1  THEN ONCE Reset; 
  
IF MarketPosition = -1 THEN ONCE Reset ;


Follow me on X Reply With Quote




Last Updated on August 3, 2018


© 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