stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Renko time problem
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=868
Page 1 of 1
Author:  chimera [ Wed Oct 03, 2012 8:51 pm ]
Post subject:  Renko time problem

Hello great minds in sir hopwoods court

I am having a little problem. I am trying some things out on the renko charts, and one thing i use is a pivot point calculation.

The problem is, how do i code it so it will update the new pivot point on the first open on the new day. Renkos are not timedependant, so i dont know when its gonna happen, could be 00:03 or 04:23.

Is the TimeHour[] and the likes gonna be enough, refernced on a Daily chart, or do i have to check opentimes of Open[0] against Open[1] every candle on the renko offline chart?? Code examples would be aprecciated. And just to be demanding, ;) , what is the best way of hardcoding indicatorcode in an EA, just declare and sort it out in the beginning of start() ??
Author:  gaheitman [ Wed Oct 03, 2012 9:43 pm ]
Post subject:  Re: Renko time problem

chimera wrote:Hello great minds in sir hopwoods court

I am having a little problem. I am trying some things out on the renko charts, and one thing i use is a pivot point calculation.

The problem is, how do i code it so it will update the new pivot point on the first open on the new day. Renkos are not timedependant, so i dont know when its gonna happen, could be 00:03 or 04:23.

Is the TimeHour[] and the likes gonna be enough, refernced on a Daily chart, or do i have to check opentimes of Open[0] against Open[1] every candle on the renko offline chart?? Code examples would be aprecciated. And just to be demanding, ;) , what is the best way of hardcoding indicatorcode in an EA, just declare and sort it out in the beginning of start() ??
I think the best route is checking that TimeDay(Time[0]) != TimeDay(Time[1])

To answer the second question, it all depends on the indicator. You don't get buffers to play with in an EA, so anything that makes multiple passes will require you to use your own arrays as buffers along with the ArraySetAsSeries() function. Magft and I spent some time trying to convert indicators in a generic fashion but we both were disappointed in the results and went back to using iCustom().

George
Author:  chimera [ Wed Oct 03, 2012 10:30 pm ]
Post subject:  Re: Renko time problem

Thank you for your quick reply.

here is a sample of the code i am trying to incorporate. the calculation part of the indi

Code: Select all

   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
//   if(counted_bars>0) counted_bars--;
   limit=(Bars-counted_bars)-1;

for (i=limit; i>=0;i--) {
if (TimeDayOfWeek(Time[i+1])!=0){ // This if fix mondays.

if (High[i+1]>LastHigh) LastHigh=High[i+1];
if (Low[i+1]<LastLow) LastLow=Low[i+1];

if (TimeDay(Time[i])!= TimeDay(Time[i+1]))
   {
   P=(LastHigh+LastLow+2*Open[i])/4;
          R1=(2*P)-LastLow;
          S1=(2*P)-LastHigh;
          R2=P + R1 - S1;
          S2=P + S1 - R1;
          R3=R2 + (R1 - P);
          S3= S2 - (P - S1); 
   LastLow=Open[i]; LastHigh=Open[i];
it is an outtake from the dailywoodpivot enclosed
Author:  chimera [ Wed Oct 03, 2012 10:41 pm ]
Post subject:  Re: Renko time problem

if it would be of interest, i can tell you the strategy i am currently exploring. it has produced decent result in manual trading.

the thing is, i think i still use too much of discretionary mind in the trading thus making it problematic to code. (and the fact i am not skilled enough to implement all i need at this point ;-) )
Author:  gaheitman [ Thu Oct 04, 2012 11:04 am ]
Post subject:  Re: Renko time problem

chimera wrote:Thank you for your quick reply.

here is a sample of the code i am trying to incorporate. the calculation part of the indi

Code: Select all

   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
//   if(counted_bars>0) counted_bars--;
   limit=(Bars-counted_bars)-1;

for (i=limit; i>=0;i--) {
if (TimeDayOfWeek(Time[i+1])!=0){ // This if fix mondays.

if (High[i+1]>LastHigh) LastHigh=High[i+1];
if (Low[i+1]<LastLow) LastLow=Low[i+1];

if (TimeDay(Time[i])!= TimeDay(Time[i+1]))
   {
   P=(LastHigh+LastLow+2*Open[i])/4;
          R1=(2*P)-LastLow;
          S1=(2*P)-LastHigh;
          R2=P + R1 - S1;
          S2=P + S1 - R1;
          R3=R2 + (R1 - P);
          S3= S2 - (P - S1); 
   LastLow=Open[i]; LastHigh=Open[i];
it is an outtake from the dailywoodpivot enclosed
Instead of trying to keep track of the highs/lows as you go, you could just as easily use iHigh(NULL,PERIOD_D1,1) for LastHigh and iLow(NULL,PERIOD_D1,1) for LastLow. You might want to look at the code in DWMPivots. In fact, you might just want to use it. :D

George
Author:  chimera [ Thu Oct 04, 2012 1:52 pm ]
Post subject:  Re: Renko time problem

well there you go... :oops: simple is often the best.

thank you good sir :)

now to try and make an EA that will actually do what i want it to do
All times are UTC Page 1 of 1