- Domov
- Komunita
- Programovanie
- Help with indicator
Edit Your Comment
Help with indicator
Členom od May 21, 2020
9 príspevkov
Oct 20, 2020 at 17:31
Členom od May 21, 2020
9 príspevkov
Can anyone review the code and explain the vertical lines that are drawn on the chart?
Here is the code:
#property strict
#property indicator_buffers 4
#property indicator_chart_window
input int InpATRperiod=14; // ATR Periods
input float InpRisk=1; // Risk Size %
input float InpSLfactor=1.5; // Stop Loss as a factor of ATR
input int InpFontSize=12; // Font size
input color InpColor=Red; // Color
input int InpBaseCorner=CORNER_RIGHT_UPPER; // Base Corner 0=UL,1=UR,2=LL,3=LR
input float InpFixedATR=0; // Fixed ATR points
string AccntC=AccountCurrency(); //Currency of Acount eg USD,GBP,EUR
string CounterC=StringSubstr(Symbol(),3,3); //The Count Currency eg GBPUSD is USD
string ExC=AccntC+CounterC; //Create the Pair for account eg USDGBP
double UpTicks[];
double DownTicks[];
double Diff[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
text_init(ChartID(),"textATR",5,InpFontSize,clrAliceBlue,InpFontSize);
text_init(ChartID(),"textBAL",5,(InpFontSize+2)*3,InpColor,InpFontSize);
text_init(ChartID(),"textRISK",5,(InpFontSize+2)*5,InpColor,InpFontSize);
text_init(ChartID(),"textlotsize",5,(InpFontSize+2)*7,White,InpFontSize);
text_init(ChartID(),"textBuyVolume",5,(InpFontSize+2)*9,clrForestGreen,InpFontSize);
text_init(ChartID(),"textSellVolume",5,(InpFontSize+2)*11,clrLightGoldenrod,InpFontSize);
text_init(ChartID(),"textDifference",5,(InpFontSize+2)*13,clrRed,InpFontSize);
SetIndexBuffer(0,UpTicks);
SetIndexBuffer(1,DownTicks);
SetIndexBuffer(2,Diff);
SetIndexLabel(0,"UpTicks");
SetIndexLabel(1,"DownTicks");
SetIndexLabel(2,"Difference");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
int i,counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
//----
for(i=0; i
Here is the code:
#property strict
#property indicator_buffers 4
#property indicator_chart_window
input int InpATRperiod=14; // ATR Periods
input float InpRisk=1; // Risk Size %
input float InpSLfactor=1.5; // Stop Loss as a factor of ATR
input int InpFontSize=12; // Font size
input color InpColor=Red; // Color
input int InpBaseCorner=CORNER_RIGHT_UPPER; // Base Corner 0=UL,1=UR,2=LL,3=LR
input float InpFixedATR=0; // Fixed ATR points
string AccntC=AccountCurrency(); //Currency of Acount eg USD,GBP,EUR
string CounterC=StringSubstr(Symbol(),3,3); //The Count Currency eg GBPUSD is USD
string ExC=AccntC+CounterC; //Create the Pair for account eg USDGBP
double UpTicks[];
double DownTicks[];
double Diff[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
text_init(ChartID(),"textATR",5,InpFontSize,clrAliceBlue,InpFontSize);
text_init(ChartID(),"textBAL",5,(InpFontSize+2)*3,InpColor,InpFontSize);
text_init(ChartID(),"textRISK",5,(InpFontSize+2)*5,InpColor,InpFontSize);
text_init(ChartID(),"textlotsize",5,(InpFontSize+2)*7,White,InpFontSize);
text_init(ChartID(),"textBuyVolume",5,(InpFontSize+2)*9,clrForestGreen,InpFontSize);
text_init(ChartID(),"textSellVolume",5,(InpFontSize+2)*11,clrLightGoldenrod,InpFontSize);
text_init(ChartID(),"textDifference",5,(InpFontSize+2)*13,clrRed,InpFontSize);
SetIndexBuffer(0,UpTicks);
SetIndexBuffer(1,DownTicks);
SetIndexBuffer(2,Diff);
SetIndexLabel(0,"UpTicks");
SetIndexLabel(1,"DownTicks");
SetIndexLabel(2,"Difference");
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
const int prev_calculated,
const datetime &time[],
const double &open[],
const double &high[],
const double &low[],
const double &close[],
const long &tick_volume[],
const long &volume[],
const int &spread[])
{
int i,counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
int limit=Bars-counted_bars;
//----
for(i=0; i
Členom od Nov 07, 2020
15 príspevkov
Nov 26, 2020 at 07:20
Členom od Nov 07, 2020
15 príspevkov
Looks like a nice quote. If you are not sure about it, I suggest trying it on your demo account first.
Členom od Nov 05, 2020
16 príspevkov
Nov 30, 2020 at 10:14
Členom od Nov 05, 2020
16 príspevkov
You need to get in touch with a programmer who can tell you this. I am not that good at coding.
*Komerčné použitie a spam nebudú tolerované a môžu viesť k zrušeniu účtu.
Tip: Uverejnením adresy URL obrázku /služby YouTube sa automaticky vloží do vášho príspevku!
Tip: Zadajte znak @, aby ste automaticky vyplnili meno používateľa, ktorý sa zúčastňuje tejto diskusie.