NexusFi: Find Your Edge


Home Menu

 





EL Code for Exit end of week, reenter start of next week


Discussion in TradeStation

Updated
    1. trending_up 1,073 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

EL Code for Exit end of week, reenter start of next week

  #1 (permalink)
kirahvi
Jersey City, NJ
 
Posts: 7 since Mar 2019
Thanks Given: 9
Thanks Received: 1

Calling All EL Wizards,

I've written code to exit all positions at the end of the week (signal "wknd") to avoid being exposed during the weekends while the futures markets are closed. I'm trying to write a code to re-enter on Monday morning at open in case the strategy had an open position at the end of the week and exited through the "wknd" signal.

Any ideas how to write this in EL? I'm thinking it will be something like this, with the parts not yet figured out in brackets:

If [lastorder was created by wknd signal] and MarketPosition = 0 then begin
Buy [the start of the next trading day] next bar market

Thanks for any ideas!

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
Cheap historycal L1 data for stocks
Stocks and ETFs
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
About a successful futures trader who didnt know anythin …
Psychology and Money Management
What broker to use for trading palladium futures
Commodities
 
  #2 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629

kirahvi,

one idea is to set a variable within your code when you issue the exit order.
Then you can evaluate this variable at the time you want to issue re-entry orders and allow those in case the variable is true. After you issue the order you'd set the variable back to false to prevent another entry based on that exit.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
Thanked by:
  #3 (permalink)
 
numberjuani's Avatar
 numberjuani 
Agoura Hills, CA USA
 
Experience: Advanced
Platform: Tradestation&Multicharts
Broker: TradeStation
Trading: Futures & Equities
Posts: 128 since Apr 2019
Thanks Given: 9
Thanks Received: 102



kirahvi View Post
Calling All EL Wizards,

I've written code to exit all positions at the end of the week (signal "wknd") to avoid being exposed during the weekends while the futures markets are closed. I'm trying to write a code to re-enter on Monday morning at open in case the strategy had an open position at the end of the week and exited through the "wknd" signal.

Any ideas how to write this in EL? I'm thinking it will be something like this, with the parts not yet figured out in brackets:

If [lastorder was created by wknd signal] and MarketPosition = 0 then begin
Buy [the start of the next trading day] next bar market

Thanks for any ideas!

Another idea is to simply hedge your position with the next contract, lets say you were long the Dec 2019 SP, friday afternoon right before the close you sell a March 2020 conctract, the spread between those two is incredibly tight and whie it might cost you a couple of dollars, so does exiting and re entering. Sometimes you even get lucky and get to close it sunday night for a profit

Reply With Quote
Thanked by:
  #4 (permalink)
kirahvi
Jersey City, NJ
 
Posts: 7 since Mar 2019
Thanks Given: 9
Thanks Received: 1

That's not a bad idea! Thanks numberjuani.


numberjuani View Post
Another idea is to simply hedge your position with the next contract, lets say you were long the Dec 2019 SP, friday afternoon right before the close you sell a March 2020 conctract, the spread between those two is incredibly tight and whie it might cost you a couple of dollars, so does exiting and re entering. Sometimes you even get lucky and get to close it sunday night for a profit


Reply With Quote




Last Updated on November 11, 2019


© 2024 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 - Privacy Policy - Downloads - Top
no new posts