37 lines
1.2 KiB
MQL5
37 lines
1.2 KiB
MQL5
void OnTick()
|
|
{
|
|
|
|
int CandlesOnChart=ChartGetInteger(0,CHART_FIRST_VISIBLE_BAR,0);
|
|
|
|
int LowestCandle;
|
|
|
|
double Low[];
|
|
|
|
ArraySetAsSeries(Low,true);
|
|
|
|
CopyLow(_Symbol,PERIOD_CURRENT,0,CandlesOnChart,Low);
|
|
|
|
LowestCandle = ArrayMinimum(Low,0,CandlesOnChart);
|
|
|
|
MqlRates PriceInformation[];
|
|
|
|
ArraySetAsSeries(PriceInformation,true);
|
|
|
|
int Data = CopyRates(_Symbol,PERIOD_CURRENT,0,CandlesOnChart,PriceInformation);
|
|
|
|
ObjectDelete(_Symbol,"Trendline");
|
|
|
|
ObjectCreate(_Symbol,"Trendline",OBJ_TREND,0,
|
|
PriceInformation[LowestCandle].time,
|
|
PriceInformation[LowestCandle].low,
|
|
PriceInformation[0].time,
|
|
PriceInformation[0].low);
|
|
ObjectSetInteger(0,"Trendline",OBJPROP_COLOR,Red);
|
|
ObjectSetInteger(0,"Trendline",OBJPROP_STYLE,STYLE_SOLID);
|
|
ObjectSetInteger(0,"Trendline",OBJPROP_WIDTH,3);
|
|
ObjectSetInteger(0,"Trendline",OBJPROP_RAY_RIGHT,true);
|
|
|
|
Comment("ObjectPrice0: ",ObjectGetDouble(0,"Trendline",OBJPROP_PRICE,0),
|
|
"\nObjectPrice5: ",ObjectGetDouble(0,"Trendline",OBJPROP_LEVELVALUE,1),
|
|
"\nCurrntBidPrice: ", SymbolInfoDouble(_Symbol,SYMBOL_BID));
|
|
}
|