
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
//+------------------------------------------------------------------ +
//| //
//| // How to draw a horizontal line with the lowest price within a given minutes ?
// and follow the PRICE change ?
//+------------------------------------------------------------------ +
#property copyright "Copyright"
#property link "MT4"
#property indicator_chart_window
extern int StartBar = 0;
extern int BarsBack = 15; // Use this indicator on M1 chart, here I want to get the lowest price in the past 15 minutes.
int init()
{
ObjectsDeleteAll();
// WindowRedraw();
return(0);
}
int deinit()
{
ObjectsDeleteAll();
// WindowRedraw();
return(0);
}
int start()
{
double StartPrice;
string Temp,TempAn;
int Lowest_bar = 0;
int Highest_bar = 0;
double Highest_point = 0;
double Lowest_point = 0;
RefreshRates();
Lowest_bar = iLowest(NULL,0,MODE_LOW,BarsBack,StartBar);
Highest_bar = iHighest(NULL,0,MODE_HIGH,7*BarsBack,StartBar);
Highest_point=High[Highest_bar];
Lowest_point=Low[Lowest_bar];
// Draw line
Temp= "LowestLine";
if(ObjectFind(Temp) != 0)
{
ObjectCreate(Temp,OBJ_HLINE,0,0,Lowest_point);
ObjectSet(Temp,OBJPROP_STYLE,STYLE_DOT);
ObjectSet(Temp,OBJPROP_COLOR,Blue);
ObjectSet(Temp,OBJPROP_WIDTH,1);
WindowRedraw();
}
Temp= "HighestLine";
if(ObjectFind(Temp) != 0)
{
ObjectCreate(Temp,OBJ_HLINE,0,0,Highest_point);
ObjectSet(Temp,OBJPROP_STYLE,STYLE_DOT);
ObjectSet(Temp,OBJPROP_COLOR,Blue);
ObjectSet(Temp,OBJPROP_WIDTH,1);
WindowRedraw();
}
// Draw line ----END
// Draw text on line
TempAn=DoubleToStr(Lowest_point,5);
if(ObjectFind(TempAn) != 0)
{
ObjectCreate(TempAn,OBJ_TEXT,0,Time[90],Lowest_point);
ObjectSetText(TempAn,"This is the lowest point line ",10,"Arial",Blue);
WindowRedraw();
}
return(0);
}