Determining the Date (or Year and Month seperately) of a Bar in a Chart - page 2

 
dpaterso:
instead of asking): would the user have to input the date with the 'D' prefix or is there a way of specifying that you're ACTUALLY inputting a date???

The manual.pdf shows

extern datetime tBegin_Data = D'2004.01.01 00:00';
extern color cModify_Color = C'0x44,0xB9,0xE6';

I know colors work, dates should.

 

Good morning,

SDC??? Don't I know that username from somewhere??? LOL!!!

WHRoeder:

Thank you too for your input. That was my question and I think you've answered it i.e. the user (trader) would actually have to input the 'D' and then the date using your method (I'm assuming).

Both of your suggestions are probably the more elegant of methods but I've decided to go with the if(TimeYear(Time[i])>=YYYY) if(TimeMonth(Time[i])>=MM) route as was originally suggested (or assisted with) by vitali_yv if not for any other reason than that is how my indicators for the other trading platform work i.e. in an effort to keep some type of uniformity (not to mention the fact that it's working 'as is' for now)!!! LOL!!!

But who knows: I may change BOTH because my original method does have ONE shortcoming that I'm aware of (not that it's been an issue in the past and nobody has complained and with this particular indicator you really only need a few months worth of data). If, for example, you wanted to check the indicator (backtest or papertrade) from, say 1 June 2010 to present your inputs would be YEAR>=2010 and MONTH>=6. What happens??? The indicator will show you the data from 1 June 2010 to 31 December 2010, then nothing until 1 June 2011 to present!!! LOL!!! So inputting an exact DATE is, as I said, the more elegant method. It's not a problem for daily (or longer) timeframes i.e. YEAR>=YYYY and MONTH>=0 but, unfortunately, I have to 'cater' for traders who wish to trade the shorter timeframes (although with this particular indicator and trading system, as with most all of mine, trading the shorter timeframes will only 'lead to tears' because of whipsaws but I have to give the trader the choice for better or for worse I guess).

But thanks EVERYBODY again for your input, help, and advice. I'm pleasantly surprised to be honest (I wasn't expecting the prompt and friendly input that I as a new member here have received). Also (as you well know SDC): MetaTrader 4 and me are NOT 'good friends' (I'm just too biased toward our proprietary trading platform) but MetaQuotes has done a 'stirling job' of getting market share so I've realised that 'if you cannot beat them then join them' (hence our now offering MetaTrader 4 in addition to our proprietary trading platform and hence my having to 'duplicate' all my indicators so that they work with MetaTrader 4). LOL!!!

Thanks (everyone) again. In just this ONE thread I've learned quite a few things that I would have needed to know ANYWAY to 'duplicate' another one of my indicators and trading systems.

Regards,

Dale.

 

Hi Dale yes its me the same SDC, lol I know mt4 was not your first choice of a platform but still I'm glad you decided to join us lol now all we need is for you to quit with those variable spreads how about a 1 pip fixed ;)

 

Hello SDC (I figured it was you)!!! LOL!!!

Why??? What's wrong with a 0.1 variable spread??? LOL!!!

But no: I'm not a 'variable spread guy' either. Unfortunately it's the way everybody seems to be going now.

Regards,

Dale.

 
dpaterso:

the user (trader) would actually have to input the 'D' and then the date using your method
I never said that. The D' is only for the code. I've never tried an extern datetime, but extern color = whatever, brings up a pop up with a color box. TRY IT
 
WHRoeder:
TRY IT

extern datetime tBegin_Data = D'2004.01.01 00:00';

Brings up 2004.01.01 00:00 in the popup box

 

Hello everyone,

OK WHRoeder: I TRIED IT!!! LOL!!! It works nicely thanks (and thanks to you to RaptorUK).

What's interesting (and great to know) is that if the user (trader) puts 'rubbish' data into the input field the 'rubbish' defaults to the current date at midnight (that was something that was worrying me i.e. what would happen if somebody input 'cr*p').

SOOO: I guess it's time to start modifying my code (for BOTH platforms i.e. it's definitely the more elegant way of doing things).

Thanks chaps.

Regards,

Dale.

Reason: