double HighLowPrice(int mode,int bars) { int mh=MODE_HIGH; int ml=MODE_LOW; int shift; double res,H,L; shift=iHighest(NULL,0,mh,bars,1); H=iHigh(NULL,0,shift); shift=iLowest(NULL,0,ml,bars,1); L=iLow(NULL,0,shift); if (mode==1) {res=H;} else if (mode==-1) {res=L;} return(res); }
HighLowPrice(1,200) => Highest Price of last 200 Bars
HighLowPrice(-1,1400) => Lowest Price of last 1400 Bars
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello
i have here a script which write data in a csv file
the open and close value comes corret.
but when i use this on the eurusd chart i get for both the high and low data from the actal chart. open and close are right.
static int mPrev;
int m;
int init()
{
mPrev=Minute();
return(0);
}
//+------------------------------------------------------------------+
int deinit()
{
int start()
{
int handle;
m=Minute();
int Pins_Back = 1;
int Pins = 24;
Pins_Back = Pins_Back + Hour() - 8;
PinsOpen = PinsOpen + Hour() -8;
double HochEU = High[iHighest("EURUSD",0,MODE_HIGH,Pins,Pins_Back)];
double TiefEU = Low[ iLowest( "EURUSD",0,MODE_LOW, Pins,Pins_Back)];
double OpenEU = iOpen("EURUSD",0,PinsOpen);
double CloseEU = iClose("EURUSD",0,Pins_Back +1);
HochGU = High[iHighest("GBPUSD",0,MODE_HIGH,Pins,Pins_Back)];
TiefGU = Low[ iLowest( "GBPUSD",0,MODE_LOW, Pins,Pins_Back)];
OpenGU = iOpen("GBPUSD",0,PinsOpen);
CloseGU = iClose("GBPUSD",0,Pins_Back + 1);
if(1==1) // old parameter, never changed
{
mPrev=m;
handle=FileOpen("Excel_Daten.csv",FILE_WRITE|FILE_CSV,",");
if(handle<0) return(0);
FileWrite(handle,"Symbol, Open 7:00, Hoch 24:00, Tief 24h, Close 6:59, Free Margin");
FileWrite(handle, "EURUSD", OpenEU, HochEU, TiefEU, CloseEU, AccountFreeMargin() ) ;
FileWrite(handle, "GBPUSD", OpenGU, HochGU, TiefGU, CloseGU ) ;
FileClose(handle);
}
return(0);
}