Tuesday, September 13, 2022

trend line indicator

 //+------------------------------------------------------------------+

//|                                                    trendline-indi.mq4 |

//|                        Copyright 2022, MetaQuotes Software Corp. |

//|                                             https://www.mql5.com |

//+------------------------------------------------------------------+

#property copyright "Copyright 2022, MetaQuotes Software Corp."

#property link      "https://www.mql5.com"

#property version   "1.00"

#property strict

//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+


//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+

void OnTick()

  {

int HighestCandle = iHighest(_Symbol,_Period,MODE_HIGH,50,10);

int lowestCandle = iLowest(_Symbol,_Period,MODE_LOW,50,10);

int HighestCandle0 = iHighest(_Symbol,_Period,MODE_HIGH,10,10);

int LowestCandle0 = iLowest(_Symbol,_Period,MODE_LOW,10,10);


ObjectDelete("hightrend");

ObjectCreate(0,"hightrend",OBJ_TREND,0,Time[HighestCandle],

High[HighestCandle],Time[2],High[2]);

   

  ObjectSetInteger(0,"hightrend",OBJPROP_COLOR,Red);

  ObjectSetInteger(0,"hightrend",OBJPROP_STYLE,STYLE_SOLID);

  ObjectSetInteger(0,"hightrend",OBJPROP_WIDTH,1);

  ObjectSetInteger(0,"hightrend",OBJPROP_RAY,true);

  

  ObjectDelete("lowtrend");

ObjectCreate(0,"lowtrend",OBJ_TREND,0,Time[lowestCandle],

Low[lowestCandle],Time[2],Low[2]);

   

  ObjectSetInteger(0,"lowtrend",OBJPROP_COLOR,Yellow);

  ObjectSetInteger(0,"lowtrend",OBJPROP_STYLE,STYLE_SOLID);

  ObjectSetInteger(0,"lowtrend",OBJPROP_WIDTH,1);

  ObjectSetInteger(0,"lowtrend",OBJPROP_RAY,true);

 Comment("highest",High[HighestCandle],"highest0",High[HighestCandle0],"\n lowestlow ",Low[lowestCandle], " low ",Low[LowestCandle0]);

  }

//+------------------------------------------------------------------+


No comments:

Post a Comment