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
ok
If you don't mind, show us a screenshot of the chart so we can see what we're talking about.
//| Flat_trend.mq5 |
//| Copyright © 2016, prostotrader |
//| http://mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2016, prostotrader"
#property link "http://mql5.com"
#property version "1.00"
#property description "Flat trend indicator"
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_plots 1
//--- plot Max
#property indicator_label1 "FT"
#property indicator_type1 DRAW_LINE
#property indicator_color1 clrYellow
#property indicator_style1 STYLE_SOLID
#property indicator_width1 1
//--- Levels
#property indicator_level1 0
#property indicator_level2 0
#property indicator_levelwidth 1
#property indicator_levelstyle STYLE_DOT
//
input double FTLine = 50; //Граница флэта
//
//--- indicator buffers
double Buff[];
double deals;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
IndicatorSetInteger(INDICATOR_DIGITS,0);
IndicatorSetString(INDICATOR_SHORTNAME,"Flat_trend");
SetIndexBuffer(0,Buff,INDICATOR_DATA);
ArraySetAsSeries(Buff,true);
PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,EMPTY_VALUE);
//---
IndicatorSetInteger(INDICATOR_LEVELCOLOR, 0, clrRed );
IndicatorSetInteger(INDICATOR_LEVELCOLOR, 1, clrRed );
IndicatorSetDouble(INDICATOR_LEVELVALUE, 0, FTLine );
IndicatorSetDouble(INDICATOR_LEVELVALUE, 1, -FTLine );
IndicatorSetDouble( INDICATOR_MAXIMUM, 105 );
IndicatorSetDouble( INDICATOR_MINIMUM, -105 );
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Custom indicator Get all deals |
//+------------------------------------------------------------------+
double GetDeals(const string a_symbol, const datetime start, const datetime end)
{
MqlTick ticks[];
int buy_deal = 0;
int sell_deal = 0;
ulong a_end = ulong(end) * 1000;
ulong a_start = ulong(start) * 1000;
int result = CopyTicks(a_symbol, ticks, COPY_TICKS_TRADE, a_start, 0);
if (result > 0 )
{
for(int i =0; i<result; i++)
{
if (ulong(ticks[i].time_msc) <= a_end)
{
if((ticks[i].flags &TICK_FLAG_BUY)==TICK_FLAG_BUY) buy_deal++;
if((ticks[i].flags &TICK_FLAG_SELL)==TICK_FLAG_SELL) sell_deal++;
}
}
return(double(buy_deal-sell_deal));
}
return( 0 );
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const int begin,
const double &price[])
{
datetime times[];
datetime end;
int result = CopyTime(Symbol(), PERIOD_CURRENT, 0, 1, times);
if (result==1)
{
end = TimeTradeServer();
deals = GetDeals(Symbol(), times[0], end);
}
//---
if (prev_calculated==0)
{
ArrayInitialize(Buff, 0);
Buff[0] = deals;
}
else
{
int a_diff = rates_total - prev_calculated;
if (a_diff > 1)
{
for (int i = 1; i<(rates_total - a_diff-1); i++)
{
Buff[i] = Buff[i+1];
}
}
Buff[0] = deals;
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
Good indicator, simple and tasteful! Marked very evenly, just amazing.
Good indicator, simple and tasteful! Marked very evenly, just amazing.
Hmm... You have a more cheerful picture, a lively one.
But seriously, what does it show? What is it now, T or F?
One is about Thomas, the other about Yerema.) In one chart there is Forex, which has never had such information, and there is FORTS on the other one. Two big differences.)
Can't you think with your head?
What difference does FORTS or FOREX make in this case?
One is about Thomas, the other about Eremia.) There is Forex on one chart, which has never had such information, and FORTS on the other. Two big differences.)
Aaaa.... It all makes sense then! It's become immediately clear where the trend is and where the flat is.... Don't make me laugh, please.
What difference does it make, forts, forex or baba Mani's kortofel exchange? Where is the correlation between the ratio of sellers to buyers shown on the chart?
It was said "but you won't find a better definition of a flat/trend", so that's what I'm asking, where does the indicator show it?
houston, come in, we've been beaten...
Aaaa.... It all makes sense then! It's become immediately clear where the trend is and where the flat is.... Don't make me laugh, please.
What difference does it make, forts, forex or baba Mani's kortofel exchange? Where is the correlation between the ratio of sellers to buyers shown on the chart?
It was said "but you won't find a better definition of a flat/trend", so that's what I'm asking, where does the indicator show it?
houston, come in, we've been beaten...
Right out of the hospital....
Exactly from the hospital....
Don't worry, it's off-topic.
You have shown the code, very well! But what does the indicator show? Explain, show the correspondence between the indicator and the areas on the chart. I want to see - the indicator shows flat, we look at the chart - hmm, it's really flat!
The indicator is fine, it's beautiful, but it shows nothing but 3 horizontal dashed lines. Maybe there's a very deep but hidden meaning behind it that I don't see. Help me understand, please.
Don't worry, it's off-topic.
You have shown the code, very well! But what does the indicator show? Explain, show the correspondence between the indicator and the areas on the chart. I want to see - the indicator shows flat, we look at the chart - hmm, it's really flat!
The indicator is fine, it's beautiful, but it shows nothing but 3 horizontal dashed lines. Maybe there's a very deep but hidden meaning behind it that I don't see. Help me understand, please.
So you don't have a table of trades in your account.
That's why CopyTicks doesn't show trades either