NexusFi: Find Your Edge


Home Menu

 





Trading Days Left in Month


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #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?
Iran Airspace Collapses 18 Points to 15.5% While Hormuz …
Prediction Markets & Event Contracts
El Clasico Draws $9.2M in Prediction Market Action -- Bi …
Prediction Markets & Event Contracts
Iran Airspace Contract Surges to 33.5% as Project Freedo …
Prediction Markets & Event Contracts
Iran Lebanon Problem Kills Switzerland Talks, Brent at $ …
Prediction Markets & Event Contracts
Hungary Called for Magyar at 97pct, Ending 16-Year Orban …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
197 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
Volume Indicators
8 thanks
BERN ALGOS algo trading journal
8 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642


Hi Mike,

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

Regards,

ABCTG


Follow me on X 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,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

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 X 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,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642

upshon,

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

Regards,

ABCTG


Follow me on X 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


© 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