help w/ indior
Results 1 to 7 of 7

Thread: help w/ indior

  1. #1
    I'm hoping someone here can help. I'm attempting to compose an indior that will tell me just how much time is remaining in a candle.

    But I can not figure out if I'm getting the right data. I get some amount that I can not translate into moments.

    I'm attempting this on a 4hr chart (backtesting. Which, for something that needs to be so straightforward, ought to be simple to do).

    Inserted Code #property indior_chart_window int init() return(0); int deinit() return(0); int begin() int counted_bars=IndiorCounted(); int limit; if(counted_barslt;0) return(-1); datetime varLeft; limitation=Bars-counted_bars-1; for(int shift=0; shiftlt;limit; shift ) varLeft=TimeCurrent()-Time#91;shift#93;; Comment(varLeft, minutes left till end of bar); return(0);

  2. #2
    Use this purpose:

    string TimeToStr( datetime value, int mode=TIME_DATE|TIME_MINUTES)
    Converts value comprising time in seconds that has passed since January 1, 1970, to a string of yyyy.mm.dd hh:mi format.
    Parameters:
    worth - Favorable amount of seconds that have passed since 00:00, January 1, 1970.
    Mode - Optional data output mode can be one or combination of:
    TIME_DATE gets consequence as yyyy.mm.dd,
    TIME_MINUTES gets consequence as hh:mi,
    TIME_SECONDS gets consequence as hh:mi:ss.

    Sample:
    string var1=TimeToStr(TimeCurrent(),TIME_DATE|TIME_SECOND S);

  3. #3
    Thanks, that gets it in a readable format, but onto a 4hour chart, it's counting down till the close of the afternoon (I used TIME_MINUTES).

    Any thoughts?

  4. #4
    VarLeft = (Time[change] 1440) - TimeCurrent();

    Take the time of the bar add 4 hours to it (1440 seconds) then reevaluate the current time.

  5. #5
    Returns invalid time error. And I get the number that is large .

  6. #6
    Here's the code that works, kind of. In a back evaluation, timecurrent() pulls last server time and not current tester time. I wish there was a way to repair that. To utilize tester time I could test my EA.
    Inserted Code // ------------------------------------------------------------------ //| Candle_Remaining_Time. mq4 | //| Copyright ? 2009, MetaQuotes Software Corp.. | //| #91;url#93;http://www.metaquotes.net#91;/url#93; | // ------------------------------------------------------------------ #property copyright Copyright ? 2009, MetaQuotes Software Corp. #property link #91;Hint#93;http://www.metaquotes.net#91;/url#93; #property indior_chart_window // ------------------------------------------------------------------ //| Custom indior initialization function | // ------------------------------------------------------------------ int init() //-- indiors //-- return(0); // ------------------------------------------------------------------ //| Custom indior deinitialization function | // ------------------------------------------------------------------ int deinit() //-- //-- return(0); // ------------------------------------------------------------------ //| Custom indior iteration function | // ------------------------------------------------------------------ int start() int counted_bars=IndiorCounted(); int limit; if(counted_barslt;0) return(-1); datetime varLeft; int varBarday, varBarhour, varBarminute, varCurday, varCurhour, varCurminute; int varRy, varRemhour, varRemminute; limit=Bars-counted_bars-1; for(int shift=0; shiftlt;limit; shift ) varBarday=TimeDay(Time#91;shift#93;-RRB-; varBarhour=TimeHour(Time#91;shift#93;-RRB-; varBarminute=TimeMinute(Time#91;shift#93;-RRB-; varCurday=TimeDay(TimeCurrent()); varCurhour=TimeHour(TimeCurrent()); varCurminute=TimeMinute(TimeCurrent()); varRy=varCurday-varBarday; varRemhour=varCurhour-varBarday; varRemminute=varCurminute-varBarminute; Comment(varRy, Days,,varRemhour, Hours,,varRemminute, Minutes until conclusion of candle); return(0); // ------------------------------------------------------------------

  7. #7
    Quote Originally Posted by ;
    returns invalid time mistake from the remark. And I get the number .
    Oops, did not think about it returning a few too low. You will have to do the math to convert the moments staying into minutes and seconds. VarLeft will contain the amount of seconds before the end of the candle.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
This website uses cookies
We use cookies to store session information to facilitate remembering your login information, to allow you to save website preferences, to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners more information