NexusFi: Find Your Edge


Home Menu

 





Trading day of week not accurate for some symbols


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #1 (permalink)
tradeout
Petersfield, UK
 
Posts: 2 since Sep 2015
Thanks Given: 0
Thanks Received: 0

Hello fellow traders,

It's been a long time since I logged into this site, which coincides with the amount of time I have not been trading. With that said, I'm ready to dive back in and looking at a purely automated approach.
I have a couple of profitable strategies in the S&P but want to look to increase the products I trade to provide better portfolio diversification. I'm in the process of taking the Larry Williams concept of TDW to put into a spreadsheet for all symbols, I've written a basic buy on open and exit on close strategy to run across various products and have created custom sessions for the main products so that they only trade the pit hours.
As Tradestation does not allow a simple buy on open I've had to use the previous day to trigger the buy on open of the next bar. One of the issues I've seen is that in a few symbols it's trading on 2 consecutive days which is throwing my results out, I'm using the exchange time session of each and the open of the next day is, absolutely, the next day. Has anybody come across this before and can point me to the error of my ways?
Symbols like E-Mini, Crude and Gold are good, Wheat, Bonds and Copper are trading on 2 consecutive days.

The code for the strategy is very simple which allows me to run the optimization for 5 days of the week easily.

inputs: DoW(1);


If DayOfWeek(date) = DoW
then buy next bar at open;

Setexitonclose;

I have an example of Wheat with a custom session of 08:30 - 13:15 with a DoW value of 2 meaning a buy at open on Wednesday only (so I thought!) which also trades on Thursday.

Thanks for a great forum everyone


Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Iran Lebanon Problem Kills Switzerland Talks, Brent at $ …
Prediction Markets & Event Contracts
The May 31 Binary: 60% Trump Declares Iran Ops Over, Onl …
Prediction Markets & Event Contracts
CME Group CEO Calls CFTC-Approved Crypto Perps Dangerous …
Traders Hideout
Warsh Drops Easing Bias, December Hike Now Above 50% -- …
Prediction Markets & Event Contracts
$12M Ceasefire Contract Goes Disputed as Bandar Abbas St …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
196 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
BERN ALGOS algo trading journal
8 thanks
  #2 (permalink)
tradeout
Petersfield, UK
 
Posts: 2 since Sep 2015
Thanks Given: 0
Thanks Received: 0

I've managed to figure this out and thought I'd post the solution in case anybody else is looking to solve this.

It seems the custom session is not enough on it's own using the day of week, by adding a < SessionEndTime this now works perfectly.


inputs: DoW(1);


If DayOfWeek(date) = DoW and Time < SessionEndTime(0,1)
then buy next bar at open;

Setexitonclose;


This is not some crazy strategy I'm looking to implement, more to find out which days work better for which symbols.

tradeout


Reply With Quote




Last Updated on September 27, 2021


© 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