|
Re: Trading Concepts Scripts
[Re: PiptheRipper]
#408932
10/09/12 14:02
10/09/12 14:02
|
Joined: Sep 2012
Posts: 99
TankWolf
Junior Member
|
Junior Member
Joined: Sep 2012
Posts: 99
|
Hi PipRipper, I dont think I can help with the first one as Im rather still a newbie myself but in regards to your second question I think it might be done like this: BarPeriod = 60; //60 minute bar period. TimeFrame = 24; // 24 * 60 minute bars. var *High = series(priceHigh()); //Creates a series of 24 hour highs. var *Low = series(priceLow()); //Creates a series of 24 hour lows. var daily_high = High[1]; //Stores the priceHigh() array from 1 day ago in the variable daily_high. var daily_low = Low[1]; //Stores the priceLow() array from 1 day ago in the variable daily_low.
I havnt tested this and like I say Im only learning but its a suggestion. Actually thought about your first question again and if my first code works then this should too. BarPeriod = 1440; //1 day bar periods. TimeFrame = 5; //5 * 1440 bar periods. var *High = series(priceHigh()); //Creates a series of 5 day highs. var *Low = series(priceLow()); //Creates a series of 5 day lows. var weekly_high = High[1]; //Stores the priceHigh() array from 1 week ago in the variable daily_high. var weekly_low = Low[1]; //Stores the priceLow() array from 1 week ago in the variable daily_low.
Last edited by TankWolf; 10/09/12 14:16. Reason: Added Code
|
|
|
Re: Trading Concepts Scripts
[Re: PiptheRipper]
#408971
10/09/12 21:50
10/09/12 21:50
|
Joined: Oct 2012
Posts: 13 CO
gfx
Newbie
|
Newbie
Joined: Oct 2012
Posts: 13
CO
|
I'm not set up to test this yet, but how about using if (dow(0) < dow(1)) { // new week The tricky bit is figuring out how many bars there are in a week. It varies on some brokers and some weeks, so instead of the HH(n) approach you might want to use something like:
var WeeklyHigh, WeeklyLow;
var WkHi = -99999, WkLo = 99999;
if (dow(0) < dow(1)) { // new week
WeeklyHigh = WkHi;
WeeklyLow = WkLo;
WkHi = -99999;
WkLo = 99999;
}
WkHi = max(WkHi, priceHigh(0));
WkLo = min(WkLo, priceLow(0));
|
|
|
Re: Trading Concepts Scripts
[Re: PiptheRipper]
#409134
10/12/12 00:30
10/12/12 00:30
|
Joined: Sep 2012
Posts: 99
TankWolf
Junior Member
|
Junior Member
Joined: Sep 2012
Posts: 99
|
BarPeriod = 60; // one-hour-bars static var WeeklyHigh = 0, WeeklyLow = 0; if(day(0) != day(5)) { // midnight of day 5 -> week has ended? WeeklyHigh = HH(120); //(24 hours *5 days) WeeklyLow = LL(120); //(24 hours *5 days) }
Because there is no week() function is this how we would find the weekly high & low? Also say if we wanted to get the high and low of a bar during the current day say for example you wanted the high and low of the opening candle of London is this how we would do it? BarPeriod = 60; // One hour bars. static var LondonOpenLow = 0, LondonOpenHigh = 0; if(hour(1) == timeOffset(UTC,0,7,0)) //Check to see if last hour was LondonOpen. LondonOpenLow = priceLow(1); //Get low from last bar? LondonOpenHigh = priceHigh(1); //Get high from last bar?
OR BarPeriod = 60; // One hour bars. static var LondonOpenLow = 0, LondonOpenHigh = 0; if(hour(1) == timeOffset(UTC,0,7,0)) //Check to see if last hour was LondonOpen. LondonOpenLow = LL(1); //Get LL from 1 bar ago? LondonOpenHigh = HH(1); //Get HH from 1 bar ago?
|
|
|
|