PDA

View Full Version : Indior Start Time



amcuixxa
12-29-2009 10:17, 10:17 AM
Does anyone have some suggestions for the best way to alter the start time of an indior so that one can have Pips to Open from a particular start time and Hi to Lo for a particular period?

I've seen it done with a couple pivot indiors but found it confusing.


Dual low0 = iLow(NULL,PERIOD_D1,0);
double high0 = iHigh(NULL,PERIOD_D1,0);
double OPEN = iOpen(NULL,1440,0);
double CLOSE = iClose(NULL,1440,0);

PIPS = DoubleToStr(((CLOSE-OPEN)/xecn)/Point,0);
HILO = DoubleToStr(((High_Today-Low_Today)/xecn)/Point,0);
https://www.nigeriaforextrading.com/attachments/15189555672031823838.mq4

amcuixxa
11-26-2021 06:38, 06:38 AM
Anyone?

ijomgeb
11-26-2021 07:58, 07:58 AM
Angus,

Assuming that you know how many bars back you need to go then it is possible to use the following:

extern int Bars_back = 10;

Period_High = High[iHighest(NULL,0,MODE_HIGH,Bars_back,0)]; //this will say that the highest value over the past ten periods
Period_Low = Low[iLowest(NULL,0,MODE_LOW,Bars_back,0)];
OPEN = iOpen(NULL,0,Bars_back);

I'm using 0 for the interval meaning that the current TF but if you wanted other timeframes then use it appropriately.

If you don't understand how many bars back that you want to proceed but you understand that the time then use iBarsShift work to determine Bars_back

amcuixxa
11-26-2021 09:19, 09:19 AM
Thank you for the answer,

But,

The issue with that approach is that you will not have a fixed beginning, since each pub that prints will cause the beginning time to move forward by a single pub. I'll keep hunting around and find out what I can produce.

Anyway, thanks again.

ijomgeb
11-26-2021 10:40, 10:40 AM
Thank you for the reply,

But,

The problem with that method is you will not have a fixed start, because each pub that prints will create the start time to proceed by one pub. I'll keep hunting around and see what I can produce.

Anyhow, thanks again. Angus,

As I was not sure exactly what you were hoping to perform I also contained the concept of ascertaining how far based in time. You will be given the change for a set time by the iBarsShift function.

If the time is 03:00 on 21 dec 2009 and currently that is 150 pubs back when a new pub is made that time will only become 151 pubs back. The ibarsshift function will recalculate how many pubs back for your start function.

amcuixxa
11-26-2021 12:01, 12:01 PM
Angus,

like I wasn't sure just what you're hoping to perform I also included the concept of determining how far based on time. You will be given the shift for a time by the iBarsShift function.

So if the time is 03:00 on 21 dec 2009 and currently that's 150 pubs back then when a new bar is made that time will just become 151 bars back. The ibarsshift function will recalculate how many pubs back for your start function. Sorry, I believed the iBarShift did something different. I believe I am on the right path. I'll let you know how it turns out.

Thank you again.