Can someone fix this so that it does not use Compile-Date but instead Recent Date. The versions I'm coming up with seems too lengthy. Since someone usually posts a shorter version after me, I'm interested to see how you guys implement Last_2_O.clock given that it could fall on a different date. If example current hour is 0 or 1.
Here something the OP can try using in the mean time.
//################################################################# //################################################################# /* Save and Compile as Script: ----------------------------- gabriel3 2010.09.15 23:48 i need to find the top (or bottom) of the price from last night 02:00 but i have condition so if the first doesnot match i want to find the next top price later in the day . the ibarshift( ) can help ? how ? */ //################################################################# //################################################################# int start(){ //################################################################# //################################################################# datetime Hour_2CheckFrom=D'2:00:00'; int Two_Oclock_Bar=iBarShift(NULL,0,Hour_2CheckFrom); double Period_HIgh=iHigh(NULL,0,Two_Oclock_Bar); double Period_Low=iLow(NULL,0,Two_Oclock_Bar); //################################################################# //################################################################# Alert("Period_HIgh=",Period_HIgh); Alert("Period_Low=",Period_Low); //################################################################# //################################################################# return(0);} //################################################################# //#################################################################
Can someone fix this so that it does not use Compile-Date but instead Recent Date. The versions I'm coming up with seems too lengthy. Since someone usually posts a shorter version after me, I'm interested to see how you guys implement Last_2_O.clock given that it could fall on a different date. If example current hour is 0 or 1.
Here something the OP can try using in the mean time.
i wrote this code for the algoritm .
barshift is calculated from ( cuurent_gmt_time - 01:00 gmt ) * period step ( for H1 1, for M15 4 etc ...)
void Find_Top_Bottom ()
{
double bar_to_shift = 4*(Hour()-1) + MathAbs(Minute()/15) ;
int i;
// start from 01:00 bar
for (i= bar_to_shift ;i>2;i--)
{
if (signal == 1) // for long
{
if ( Low[i] < lowest &&
( Low[i]+15*Point_Info < iMA(NULL,0, 20, 0, MODE_EMA, PRICE_CLOSE, i) )
)
{
lowest = Low[i] ; bar_from_midnight = bar_to_shift - i ;
}
if (High[i] > iMA(NULL,0, 50, 0, MODE_EMA, PRICE_CLOSE, i))
{
lowest = 100000 ; bar_from_midnight = 0 ;
}
}
if (signal == -1) // for short
{
if ( High[i] > highest &&
( High[i]- 15 *Point_Info > iMA(NULL,0, 20, 0, MODE_EMA, PRICE_CLOSE, i) )
)
{
highest = High[i] ; bar_from_midnight = bar_to_shift - i ;
}
if ( Low[i] + 15 *Point_Info < iMA(NULL,0, 50, 0, MODE_EMA, PRICE_CLOSE, i))
{
highest = -100000 ; bar_from_midnight = 0 ;
}
}
}
} // Find_Top_Bottom
i need to find the top (or bottom) of the price from last night 02:00
// If you're on a H1 chart only: for (int shift=0; Hour(Time[shift]) != 2; shift++) {} int highestBar = Highest(NULL,0, MODE_HIGH, shift+1,0); // If you're on a H1 or smaller chart: for (int shift=0; Hour(Time[shift+1]) != 1; shift++) {}
datetime Hour_2CheckFrom=D'2:00:00'; int Two_Oclock_Bar=iBarShift(NULL,0,Hour_2CheckFrom); double max = High[iHighest(NULL,0,MODE_HIGH,Two_Oclock_Bar,0)]; double min = Low[ iLowest( NULL,0,MODE_LOW, Two_Oclock_Bar,0)];
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
i need to find the top (or bottom) of the price
from last night 02:00 but i have condition so if the first doesnot
match i want to find the next top price later in the day .
the ibarshift( ) can help ? how ?