GS trend I
- Göstergeler
- Aleksander Gladkov
- Sürüm: 1.2
- Güncellendi: 17 Mart 2025
- Etkinleştirmeler: 10
The trend indicator has the ability to adjust the viewing depth and sensitivity, does not repaint and does not lag.
In addition to the current trend, the chart displays trends for 5 more periods with zero trend levels for them.
This allows for a comprehensive assessment of the nature of the trend movement.
There is a possibility to choose the trend algorithm settings {Only Open, Average Open/Close, Average High/Low}
The trend indicator can be used for any Forex financial instruments.
The color shows the direction of the trend:
- yellow - direction can be SELL or BUY
- blue - uptrend BUY
- red - downtrend SELL
The indicator panel displays the trend values of 5 timeframes for the current price level.
The trend value is recorded by the indicator when the next candle opens.
Usage
- For visual control of trends and adjustment of advisor parameters or decision making on opening orders manually.
- For use in your own advisors as one of the criteria for making a decision to open an order
An example of an advisor accessing the value of a trend indicator:
#property copyright "Copyright 2025, MetaQuotes Ltd."
#property link " https://www.mql5.com "
#property version "1.00"
#resource "\\Indicators\\GS_trend_I_v12.ex5"
int handle;
//--- input parameters
input int InpTimer=1; //Timer,sec
input int NN=5; //Limit
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
handle=iCustom(NULL,0,"::Indicators\\GS_trend_I_v12.ex5");
if(handle==INVALID_HANDLE)
{
PrintFormat("Error getting the indicator handle GS trend I. Error code = %d",GetLastError());
return(INIT_FAILED);
}
//--- create timer
EventSetTimer(InpTimer);
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy timer
EventKillTimer();
}
//------------------------------
double iCustomGet(const int ind_handle,const int buffer,int start_pos)
{
double Custom[1];
ResetLastError();
if(CopyBuffer(ind_handle,buffer,start_pos,1,Custom)<0)
{
PrintFormat("Failed to copy data from the indicator, error code %d",GetLastError());
return(0.0);
}
return(Custom[0]);
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{ static int i=0;
if (i>NN) return;
double r=iCustomGet(handle,1,i);
Alert("i="+(string)i+": GS trend Signal = "+DoubleToString(r,5)+((r==0)?" (SELL_BUY)":(r==1)?" (BUY)":(r==2)?" (SELL)":" (No data)"));
i++;
}