NexusFi: Find Your Edge


Home Menu

 





Code for trading a part of the month?


Discussion in EasyLanguage Programming

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




 
Search this Thread

Code for trading a part of the month?

  #1 (permalink)
Orjan
Stockholm Sweden
 
Posts: 20 since Apr 2012
Thanks Given: 12
Thanks Received: 2

I want one of my signals only to be traded the periods between day 1 and 5 and day 21 and day 31 every month. Not the other days. I guess I should use the reserved word "DayOfMonth" but I dont know how.

Does anyone have a clue?

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
What broker to use for trading palladium futures
Commodities
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
REcommedations for programming help
Sierra Chart
 
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,463 since Jun 2009
Thanks Given: 33,239
Thanks Received: 101,661



Orjan View Post
I want one of my signals only to be traded the periods between day 1 and 5 and day 21 and day 31 every month. Not the other days. I guess I should use the reserved word "DayOfMonth" but dont no how.

Does anyone have a clue?

Untested - something like:

vars:
cantrade (false);

if DayOfMonth(date) >= 1 and DayOfMonth(date) <= 5 then cantrade = true;
if DayOfMonth(date) >= 21 and DayOfMonth(date) <= 31 then cantrade = true;

In MultiCharts, you can then do:

if cantrade = false then #return;

I am sure TradeStation has an equivalent, but I don't know what it is. Alternatively, just test for cantrade to be true before trading.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
Orjan
Stockholm Sweden
 
Posts: 20 since Apr 2012
Thanks Given: 12
Thanks Received: 2

Thanks, it works.

I also put in a false condition for the rest of the month, don't know if it is needed:

If DayOfMonth(date) >= 6 and DayOfMonth(date) <= 20 then cantrade = false;


Perhaps the "false" statement is enough? It makes an exception from the basic code that sas every day is Ok to trade.

Reply With Quote




Last Updated on April 14, 2012


© 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