NexusFi: Find Your Edge


Home Menu

 





Trading Days Left in Month


Discussion in EasyLanguage Programming

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




 
Search this Thread

Trading Days Left in Month

  #1 (permalink)
 upshon 
New Zealand
 
Experience: Advanced
Platform: Multicharts, TradeNav
Trading: Futures
Posts: 6 since Dec 2010
Thanks Given: 3
Thanks Received: 2

Hi

I am having some trouble building a function to tell me how many trading days are left in the monh.

below is the code I have so far.

variables: tdlim(0), thisMonth(0), lastDate(0), count(0);

thisMonth = Month(date[0]);
lastDate = symbol_date[0];
count = 0;
tdlim = 0;

while Month(symbol_date[count]) = thisMonth begin

if lastDate <> symbol_date[count] then begin
tdlim = tdlim + 1;
lastDate = symbol_date[count];
end;

count = count - 1;
end;


I am having a problem when I reach the end of the bar series, I dont know how to stop it tring to refer to bars that dont exist, is there a way to tel the number of bars loaded?

Thanks

Mike

Started this thread Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
Increase in trading performance by 75%
The Elite Circle
ZombieSqueeze
Platforms and Indicators
MC PL editor upgrade
MultiCharts
Better Renko Gaps
The Elite Circle
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Just another trading journal: PA, Wyckoff & Trends
29 thanks
Tao te Trade: way of the WLD
24 thanks
Diary of a simple price action trader
21 thanks
My NQ Trading Journal
14 thanks
GFIs1 1 DAX trade per day journal
10 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627


Hi Mike,

CurrentBar + MaxBarsBack should give you the total number of bars on the chart.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #4 (permalink)
 upshon 
New Zealand
 
Experience: Advanced
Platform: Multicharts, TradeNav
Trading: Futures
Posts: 6 since Dec 2010
Thanks Given: 3
Thanks Received: 2

Thanks for the reply,

However MaxBarsBack is always 0

Im using Multicharts 9.1


ABCTG View Post
Hi Mike,

CurrentBar + MaxBarsBack should give you the total number of bars on the chart.

Regards,

ABCTG


Started this thread Reply With Quote
  #5 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

upshon,

I don't understand why this would matter? CurrentBar + MaxBarsBack (if it's 0, 100 or 500 does not matter) gives you the total number of bars on the chart. You can use this value then in your loop to make sure that you don't try to look beyond data available on the chart.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #6 (permalink)
 upshon 
New Zealand
 
Experience: Advanced
Platform: Multicharts, TradeNav
Trading: Futures
Posts: 6 since Dec 2010
Thanks Given: 3
Thanks Received: 2

ABCTG

I am looking forward not backwards. in my while loop I am counting bars ahead of current bar where future bar month is the same as current bar. If I dont know the total number of bars in the price series and I try and reference a bar that does not exist Multiharts throws error.

Current bar gives me the bar I am currently referencing, maxbarsback is always 0.

Again thanks for your help.

Started this thread Reply With Quote
  #7 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,433 since Apr 2013
Thanks Given: 481
Thanks Received: 1,627

upshon,

check out Symbol_Length then, this should provide you with what you are looking for.

Regards,

ABCTG

Follow me on Twitter Reply With Quote
  #8 (permalink)
 upshon 
New Zealand
 
Experience: Advanced
Platform: Multicharts, TradeNav
Trading: Futures
Posts: 6 since Dec 2010
Thanks Given: 3
Thanks Received: 2

Thanks ABCTG

Symbol_length was just what I was after.

Started this thread Reply With Quote




Last Updated on March 26, 2016


© 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