Thanks Friend! ... seems like It was my mistake!pacois wrote: Mon Jul 22, 2019 7:10 pm hello, the parameter 13 that you set in the iCustom function corresponds to the one in the picture is right?

Thanks Friend! ... seems like It was my mistake!pacois wrote: Mon Jul 22, 2019 7:10 pm hello, the parameter 13 that you set in the iCustom function corresponds to the one in the picture is right?
Code: Select all
//------------------------------------------------------------------
#property indicator_chart_window
#define C 67
extern bool indicator_ON = true;
double CHARTTYPE;
int OnInit()
{
CHARTTYPE = getCHARTTYPE_glovar();
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason)
{
if (reason==REASON_REMOVE) GlobalVariableDel("ChangeChartType"+ Symbol()+string(ChartID()));
}
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[])
{
if (indicator_ON) updateCHARTTYPE(CHARTTYPE);
return(rates_total);
}
///
void OnChartEvent(const int id,const long& lparam,const double& dparam,const string& sparam)
{
if(id == CHARTEVENT_KEYDOWN && lparam == C)
{press_C();}
}
//-------------------------------------------------------------------
//
//-------------------------------------------------------------------
//
double getCHARTTYPE_glovar()
{
double result;
//
if (indicator_ON)
{
if (GlobalVariableCheck("ChangeChartType"+ Symbol()+string(ChartID())))
{
if ( (GlobalVariableGet("ChangeChartType"+ Symbol()+string(ChartID())) == 0)
|| (GlobalVariableGet("ChangeChartType"+ Symbol()+string(ChartID())) == 1) )
{result = GlobalVariableGet("ChangeChartType"+ Symbol()+string(ChartID()));}
}
else
{
result = 1;
GlobalVariableSet("ChangeChartType"+ Symbol()+string(ChartID()),1);// Creat & set initial value for global variable
}
}
return(result);
}
///////
void press_C()
{
double charttype = GlobalVariableGet("ChangeChartType"+ Symbol()+string(ChartID()));
//
if (indicator_ON)
{
if(charttype ==0)
{
CHARTTYPE = 1;
GlobalVariableSet("ChangeChartType"+ Symbol()+string(ChartID()),1);
//
}
else if(charttype ==1)
{
CHARTTYPE = 0;
GlobalVariableSet("ChangeChartType"+ Symbol()+string(ChartID()),0);
//
}
}
//
updateCHARTTYPE(CHARTTYPE);
}
///////
void updateCHARTTYPE (double ChartType)
{
long Chart_ID = ChartID();
//
ChartSetInteger(Chart_ID,CHART_MODE,ChartType);
}
Maybe this code will help with it you can change from bars to candles, with an on chart button.aphong wrote: Sun Aug 04, 2019 2:07 pm Hi all pro coders,
Im new to mql
Im trying to code an simple indicator to quickly change chart type between bar charts & candlestick chart when press C key... but something weird happened, my indi seems only work when there is a tick comming, i think i should work right away after I press C key! Dont know what is the problem here? ... one more thing, I notice that when I press C key then the bars/ candlestick icon is changed immediately but the display on main chart is not =))
Could anyone please find BUGs in my simple indi? attached is the codes
thanks & have a good weekend![]()
Code: Select all
//------------------------------------------------------------------ #property indicator_chart_window #define C 67 extern bool indicator_ON = true; double CHARTTYPE; int OnInit() { CHARTTYPE = getCHARTTYPE_glovar(); return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { if (reason==REASON_REMOVE) GlobalVariableDel("ChangeChartType"+ Symbol()+string(ChartID())); } 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[]) { if (indicator_ON) updateCHARTTYPE(CHARTTYPE); return(rates_total); } /// void OnChartEvent(const int id,const long& lparam,const double& dparam,const string& sparam) { if(id == CHARTEVENT_KEYDOWN && lparam == C) {press_C();} } //------------------------------------------------------------------- // //------------------------------------------------------------------- // double getCHARTTYPE_glovar() { double result; // if (indicator_ON) { if (GlobalVariableCheck("ChangeChartType"+ Symbol()+string(ChartID()))) { if ( (GlobalVariableGet("ChangeChartType"+ Symbol()+string(ChartID())) == 0) || (GlobalVariableGet("ChangeChartType"+ Symbol()+string(ChartID())) == 1) ) {result = GlobalVariableGet("ChangeChartType"+ Symbol()+string(ChartID()));} } else { result = 1; GlobalVariableSet("ChangeChartType"+ Symbol()+string(ChartID()),1);// Creat & set initial value for global variable } } return(result); } /////// void press_C() { double charttype = GlobalVariableGet("ChangeChartType"+ Symbol()+string(ChartID())); // if (indicator_ON) { if(charttype ==0) { CHARTTYPE = 1; GlobalVariableSet("ChangeChartType"+ Symbol()+string(ChartID()),1); // } else if(charttype ==1) { CHARTTYPE = 0; GlobalVariableSet("ChangeChartType"+ Symbol()+string(ChartID()),0); // } } // updateCHARTTYPE(CHARTTYPE); } /////// void updateCHARTTYPE (double ChartType) { long Chart_ID = ChartID(); // ChartSetInteger(Chart_ID,CHART_MODE,ChartType); }
Great! it works like a charm Mastermrtools wrote: Sun Aug 04, 2019 4:49 pm ...
Maybe this code will help with it you can change from bars to candles, with an on chart button.
Code: Select all
//+------------------------------------------------------------------+
//+------------------------------------------------------------------+
//------------------------------------------------------------------
#property indicator_chart_window
#define C 67
extern bool indicator_ON = true;
int OnInit()
{
return(INIT_SUCCEEDED);
}
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[])
{
return(rates_total);
}
///
void OnChartEvent(const int id,const long& lparam,const double& dparam,const string& sparam)
{
if(id == CHARTEVENT_KEYDOWN && lparam == C)
{press_C();}
}
//-------------------------------------------------------------------
//
//-------------------------------------------------------------------
//
///////
void press_C()
{
//
if (indicator_ON)
{
updateCHARTTYPE();
}
}
///////
void updateCHARTTYPE ()
{
long Chart_ID = ChartID();
//
double CHARTTYPE = ChartGetInteger(Chart_ID,CHART_MODE);
if (CHARTTYPE !=1) ChartSetInteger(Chart_ID,CHART_MODE,1);
else if (CHARTTYPE !=0) ChartSetInteger(Chart_ID,CHART_MODE,0);
}
Code: Select all
#property indicator_chart_window
#define C 67
extern bool indicator_ON = true;
int OnInit()
{
return(INIT_SUCCEEDED);
}
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[])
{
return(rates_total);
}
///
void OnChartEvent(const int id,const long& lparam,const double& dparam,const string& sparam)
{
if(id == CHARTEVENT_KEYDOWN && lparam == C)
{press_C();}
}
///////
void press_C()
{
//
if (indicator_ON)
{
updateCHARTTYPE();
ChartRedraw(0);
}
}
///////
void updateCHARTTYPE ()
{
long Chart_ID = ChartID();
//
double CHARTTYPE = ChartGetInteger(Chart_ID,CHART_MODE);
if (CHARTTYPE !=1) ChartSetInteger(Chart_ID,CHART_MODE,1);
else if (CHARTTYPE !=0) ChartSetInteger(Chart_ID,CHART_MODE,0);
}
Hi, iRSIOnArray has no price options.nyol wrote: Mon Aug 05, 2019 6:28 am Hello Guys
I am inciting my studies in MQL4 language, so my level of knowledge is that of a novice.
I have used the EA Builder to create object-oriented way my first indicators and so I will make several combinations of technical indicators and then analyze the generated codes, which will give me a little notion of things.
My question is:
When I import a custom indicator for EA Builder I do not have the option to declare a condition applied to opening or closing the price.
Example:
In this image you can see that the option to declare a value the condition of the price applied at the time of its closing, is available when we choose the indicator RSI (Relative Strength Index)
But after importing the MomPinboll indicator from "Karakurt " I do not have the option to declare a value the condition and apply it to opening or closing the price.
What do I need to do to make this option available which is crucial to create my indicator?
If any kind-hearted guru can help me I would be immensely grateful.
Good luck to everyone
Code: Select all
//+------------------------------------------------------------------+
//| Volatility quality.mq4 |
//| |
//| |
//| Volatility quality index originaly developed by |
//| Thomas Stridsman (August 2002 Active Trader Magazine) |
//+------------------------------------------------------------------+
#property copyright "www.forex-station.com"
#property link "www.forex-station.com"
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 PaleVioletRed
#property indicator_color2 PaleVioletRed
#property indicator_color3 DeepSkyBlue
#property indicator_color4 DeepSkyBlue
#property indicator_color5 Silver
#property indicator_width1 2
#property indicator_width3 2
#property indicator_width5 2
#property indicator_levelcolor DarkGray
//
//
//
//
//
extern string TimeFrame = "Current time frame";
extern int PriceSmoothing = 5;
extern int PriceSmoothingMethod = MODE_LWMA;
extern double Filter = 0.05;
extern bool divergenceVisible = true;
extern bool divergenceOnValuesVisible = true;
extern bool divergenceOnChartVisible = true;
extern color divergenceBullishColor = Green;
extern color divergenceBearishColor = OrangeRed;
extern string divergenceUniqueID = "vq diverge1";
extern bool HistogramOnSlope = false;
extern bool Interpolate = true;
extern bool alertsOn = false;
extern bool alertsOnSlope = false;
extern bool alertsOnCurrent = true;
extern bool alertsMessage = true;
extern bool alertsSound = false;
extern bool alertsEmail = false;
//
//
//
//
//
double Upa[];
double Upb[];
double Dna[];
double Dnb[];
double sumVqi[];
double Vqi[];
double trend[];
double slope[];
int timeFrame;
string indicatorFileName;
bool returnBars;
bool calculateValue;
string shortName;
//+------------------------------------------------------------------
//|
//+------------------------------------------------------------------
//
//
//
//
//
int init()
{
IndicatorBuffers(8);
SetIndexBuffer(0,Dna); SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(1,Dnb); SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(2,Upa); SetIndexStyle(2,DRAW_HISTOGRAM);
SetIndexBuffer(3,Upb); SetIndexStyle(3,DRAW_HISTOGRAM);
SetIndexBuffer(4,sumVqi);
SetIndexBuffer(5,Vqi);
SetIndexBuffer(6,trend);
SetIndexBuffer(7,slope);
SetLevelValue(0,0);
PriceSmoothing = MathMax(PriceSmoothing,1);
//
//
//
//
//
indicatorFileName = WindowExpertName();
returnBars = (TimeFrame=="returnBars"); if (returnBars) return(0);
calculateValue = (TimeFrame=="calculateValue");
if (calculateValue)
{
int s = StringFind(divergenceUniqueID,":",0);
shortName = divergenceUniqueID;
divergenceUniqueID = StringSubstr(divergenceUniqueID,0,s);
return(0);
}
timeFrame = stringToTimeFrame(TimeFrame);
//
//
//
//
//
shortName = divergenceUniqueID+": "+timeFrameToString(timeFrame)+" Volatility quality zero line ";
IndicatorShortName(shortName);
return(0);
}
//
//
//
//
//
int deinit()
{
int lookForLength = StringLen(divergenceUniqueID);
for (int i=ObjectsTotal()-1; i>=0; i--)
{
string objectName = ObjectName(i);
if (StringSubstr(objectName,0,lookForLength) == divergenceUniqueID) ObjectDelete(objectName);
}
return(0);
}
//------------------------------------------------------------------
//
//------------------------------------------------------------------
//
//
//
//
//
int start()
{
int counted_bars=IndicatorCounted();
int i,limit;
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit = MathMin(Bars-counted_bars,Bars-1);
if (returnBars) { Dna[0] = limit+1; return(0); }
double pipMultiplier = MathPow(10,_Digits%2);
//
//
//
//
//
if (calculateValue || timeFrame == Period())
{
for(i=limit; i>=0; i--)
{
if (i==(Bars-1))
{
Vqi[i] = 0;
sumVqi[i] = 0;
continue;
}
//
//
//
//
//
double cHigh = iMA(NULL,0,PriceSmoothing,0,PriceSmoothingMethod,PRICE_HIGH ,i);
double cLow = iMA(NULL,0,PriceSmoothing,0,PriceSmoothingMethod,PRICE_LOW ,i);
double cOpen = iMA(NULL,0,PriceSmoothing,0,PriceSmoothingMethod,PRICE_OPEN ,i);
double cClose = iMA(NULL,0,PriceSmoothing,0,PriceSmoothingMethod,PRICE_CLOSE,i);
double pClose = iMA(NULL,0,PriceSmoothing,0,PriceSmoothingMethod,PRICE_CLOSE,i+1);
double trueRange = MathMax(cHigh,pClose)-MathMin(cLow,pClose);
double range = cHigh-cLow;
if (range != 0 && trueRange!=0)
double vqi = ((cClose-pClose)/trueRange + (cClose-cOpen)/range)*0.5;
else vqi = Vqi[i+1];
//
//
//
//
//
Vqi[i] = MathAbs(vqi) * (cClose - pClose+cClose - cOpen) * 0.5;
sumVqi[i] = Vqi[i];
Dna[i] = EMPTY_VALUE;
Dnb[i] = EMPTY_VALUE;
Upa[i] = EMPTY_VALUE;
Upb[i] = EMPTY_VALUE;
if (Filter > 0) if (fabs(sumVqi[i]-sumVqi[i+1]) < Filter*Point*pipMultiplier) sumVqi[i] = sumVqi[i+1];
//
//
//
//
//
trend[i] = trend[i+1];
slope[i] = slope[i+1];
if (sumVqi[i] > 0) trend[i] = 1;
if (sumVqi[i] < 0) trend[i] = -1;
if (sumVqi[i] > sumVqi[i+1]) slope[i] = 1;
if (sumVqi[i] < sumVqi[i+1]) slope[i] = -1;
if (divergenceVisible)
{
CatchBullishDivergence(sumVqi,i);
CatchBearishDivergence(sumVqi,i);
}
if (HistogramOnSlope)
{
if (trend[i]== 1 && slope[i] == 1) Upa[i] = sumVqi[i];
if (trend[i]== 1 && slope[i] ==-1) Upb[i] = sumVqi[i];
if (trend[i]==-1 && slope[i] ==-1) Dna[i] = sumVqi[i];
if (trend[i]==-1 && slope[i] == 1) Dnb[i] = sumVqi[i];
}
else
{
if (trend[i]== 1) Upa[i] = sumVqi[i];
if (trend[i]==-1) Dna[i] = sumVqi[i];
}
}
manageAlerts();
return(0);
}
//
//
//
//
//
limit = MathMax(limit,MathMin(Bars-1,iCustom(NULL,timeFrame,indicatorFileName,"returnBars",0,0)*timeFrame/Period()));
for(i=limit; i>=0; i--)
{
int y = iBarShift(NULL,timeFrame,Time[i]);
sumVqi[i] = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",PriceSmoothing,PriceSmoothingMethod,Filter,divergenceVisible,divergenceOnValuesVisible,divergenceOnChartVisible,divergenceBullishColor,divergenceBearishColor,shortName,Interpolate,4,y);
trend[i] = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",PriceSmoothing,PriceSmoothingMethod,Filter,divergenceVisible,divergenceOnValuesVisible,divergenceOnChartVisible,divergenceBullishColor,divergenceBearishColor,shortName,Interpolate,6,y);
slope[i] = iCustom(NULL,timeFrame,indicatorFileName,"calculateValue",PriceSmoothing,PriceSmoothingMethod,Filter,divergenceVisible,divergenceOnValuesVisible,divergenceOnChartVisible,divergenceBullishColor,divergenceBearishColor,shortName,Interpolate,7,y);
Dna[i] = EMPTY_VALUE;
Dnb[i] = EMPTY_VALUE;
Upa[i] = EMPTY_VALUE;
Upb[i] = EMPTY_VALUE;
//
//
//
//
//
if (!Interpolate || y==iBarShift(NULL,timeFrame,Time[i-1])) continue;
//
//
//
//
//
datetime time = iTime(NULL,timeFrame,y);
for(int n = 1; i+n < Bars && Time[i+n] >= time; n++) continue;
for(int k = 1; k < n; k++)
sumVqi[i+k] = sumVqi[i] + (sumVqi[i+n] - sumVqi[i]) * k/n;
}
for (i=limit;i>=0;i--)
{
if (HistogramOnSlope)
{
if (trend[i]== 1 && slope[i] == 1) Upa[i] = sumVqi[i];
if (trend[i]== 1 && slope[i] ==-1) Upb[i] = sumVqi[i];
if (trend[i]==-1 && slope[i] ==-1) Dna[i] = sumVqi[i];
if (trend[i]==-1 && slope[i] == 1) Dnb[i] = sumVqi[i];
}
else
{
if (trend[i]== 1) Upa[i] = sumVqi[i];
if (trend[i]==-1) Dna[i] = sumVqi[i];
}
}
manageAlerts();
return(0);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
//
//
//
//
//
void manageAlerts()
{
if (!calculateValue && alertsOn)
{
if (alertsOnCurrent)
int whichBar = 0;
else whichBar = 1; whichBar = iBarShift(NULL,0,iTime(NULL,timeFrame,whichBar));
//
//
//
//
//
if (alertsOnSlope)
{
if (slope[whichBar] != slope[whichBar+1])
{
if (slope[whichBar] == 1) doAlert(whichBar,"slope changed to up");
if (slope[whichBar] ==-1) doAlert(whichBar,"slope changed to down");
}
}
else
{
if (trend[whichBar] != trend[whichBar+1])
{
if (trend[whichBar] == 1) doAlert(whichBar,"crossed zero line up");
if (trend[whichBar] ==-1) doAlert(whichBar,"crossed zero line down");
}
}
}
}
//
//
//
//
//
void doAlert(int forBar, string doWhat)
{
static string previousAlert="nothing";
static datetime previousTime;
string message;
if (previousAlert != doWhat || previousTime != Time[forBar]) {
previousAlert = doWhat;
previousTime = Time[forBar];
//
//
//
//
//
message = StringConcatenate(Symbol()," ",timeFrameToString(timeFrame)," at ",TimeToStr(TimeLocal(),TIME_SECONDS)," VQ oscillator ",doWhat);
if (alertsMessage) Alert(message);
if (alertsEmail) SendMail(StringConcatenate(Symbol(),"VQ"),message);
if (alertsSound) PlaySound("alert2.wav");
}
}
//+------------------------------------------------------------------
//|
//+------------------------------------------------------------------
//
//
//
//
//
void CatchBullishDivergence(double& values[], int i)
{
i++;
ObjectDelete(divergenceUniqueID+"l"+DoubleToStr(Time[i],0));
ObjectDelete(divergenceUniqueID+"l"+"os" + DoubleToStr(Time[i],0));
if (!IsIndicatorLow(values,i)) return;
//
//
//
//
//
int currentLow = i;
int lastLow = GetIndicatorLastLow(values,i+1);
if (values[currentLow] > values[lastLow] && Low[currentLow] < Low[lastLow])
{
if(divergenceOnChartVisible) DrawPriceTrendLine("l",Time[currentLow],Time[lastLow],Low[currentLow],Low[lastLow],divergenceBullishColor,STYLE_SOLID);
if(divergenceOnValuesVisible) DrawIndicatorTrendLine("l",Time[currentLow],Time[lastLow],values[currentLow],values[lastLow],divergenceBullishColor,STYLE_SOLID);
}
if (values[currentLow] < values[lastLow] && Low[currentLow] > Low[lastLow])
{
if(divergenceOnChartVisible) DrawPriceTrendLine("l",Time[currentLow],Time[lastLow],Low[currentLow],Low[lastLow], divergenceBullishColor, STYLE_DOT);
if(divergenceOnValuesVisible) DrawIndicatorTrendLine("l",Time[currentLow],Time[lastLow],values[currentLow],values[lastLow], divergenceBullishColor, STYLE_DOT);
}
}
//
//
//
//
//
void CatchBearishDivergence(double& values[], int i)
{
i++;
ObjectDelete(divergenceUniqueID+"h"+DoubleToStr(Time[i],0));
ObjectDelete(divergenceUniqueID+"h"+"os" + DoubleToStr(Time[i],0));
if (IsIndicatorPeak(values,i) == false) return;
//
//
//
//
//
int currentPeak = i;
int lastPeak = GetIndicatorLastPeak(values,i+1);
if (values[currentPeak] < values[lastPeak] && High[currentPeak]>High[lastPeak])
{
if (divergenceOnChartVisible) DrawPriceTrendLine("h",Time[currentPeak],Time[lastPeak],High[currentPeak],High[lastPeak],divergenceBearishColor,STYLE_SOLID);
if (divergenceOnValuesVisible) DrawIndicatorTrendLine("h",Time[currentPeak],Time[lastPeak],values[currentPeak],values[lastPeak],divergenceBearishColor,STYLE_SOLID);
}
if(values[currentPeak] > values[lastPeak] && High[currentPeak] < High[lastPeak])
{
if (divergenceOnChartVisible) DrawPriceTrendLine("h",Time[currentPeak],Time[lastPeak],High[currentPeak],High[lastPeak], divergenceBearishColor, STYLE_DOT);
if (divergenceOnValuesVisible) DrawIndicatorTrendLine("h",Time[currentPeak],Time[lastPeak],values[currentPeak],values[lastPeak], divergenceBearishColor, STYLE_DOT);
}
}
//
//
//
//
//
bool IsIndicatorPeak(double& values[], int i) { return(values[i] >= values[i+1] && values[i] > values[i+2] && values[i] > values[i-1]); }
bool IsIndicatorLow( double& values[], int i) { return(values[i] <= values[i+1] && values[i] < values[i+2] && values[i] < values[i-1]); }
int GetIndicatorLastPeak(double& values[], int shift)
{
for(int i = shift+5; i<Bars; i++)
if (values[i] >= values[i+1] && values[i] > values[i+2] && values[i] >= values[i-1] && values[i] > values[i-2]) return(i);
return(-1);
}
int GetIndicatorLastLow(double& values[], int shift)
{
for(int i = shift+5; i<Bars; i++)
if (values[i] <= values[i+1] && values[i] < values[i+2] && values[i] <= values[i-1] && values[i] < values[i-2]) return(i);
return(-1);
}
//+------------------------------------------------------------------
//|
//+------------------------------------------------------------------
//
//
//
//
//
void DrawPriceTrendLine(string first,datetime t1, datetime t2, double p1, double p2, color lineColor, double style)
{
string label = divergenceUniqueID+first+"os"+DoubleToStr(t1,0);
if (Interpolate) t2 += Period()*60-1;
ObjectDelete(label);
ObjectCreate(label, OBJ_TREND, 0, t1+Period()*60-1, p1, t2, p2, 0, 0);
ObjectSet(label, OBJPROP_RAY, false);
ObjectSet(label, OBJPROP_COLOR, lineColor);
ObjectSet(label, OBJPROP_STYLE, style);
}
//
//
//
//
//
void DrawIndicatorTrendLine(string first,datetime t1, datetime t2, double p1, double p2, color lineColor, double style)
{
int indicatorWindow = WindowFind(shortName);
if (indicatorWindow < 0) return;
if (Interpolate) t2 += Period()*60-1;
string label = divergenceUniqueID+first+DoubleToStr(t1,0);
ObjectDelete(label);
ObjectCreate(label, OBJ_TREND, indicatorWindow, t1+Period()*60-1, p1, t2, p2, 0, 0);
ObjectSet(label, OBJPROP_RAY, false);
ObjectSet(label, OBJPROP_COLOR, lineColor);
ObjectSet(label, OBJPROP_STYLE, style);
}
//+-------------------------------------------------------------------
//|
//+-------------------------------------------------------------------
//
//
string sTfTable[] = { "M1","M5","M15","M30","H1","H4","D1","W1","MN" };
int iTfTable[] = { 1,5,15,30,60,240,1440,10080,43200 };
//
//
//
//
//
int stringToTimeFrame(string tfs) {
tfs = stringUpperCase(tfs);
for (int i=ArraySize(iTfTable)-1; i>=0; i--)
if (tfs==sTfTable[i] || tfs==""+iTfTable[i]) return(MathMax(iTfTable[i],Period()));
return(Period());
}
//
//
//
//
//
string timeFrameToString(int tf) {
for (int i=ArraySize(iTfTable)-1; i>=0; i--)
if (tf==iTfTable[i]) return(sTfTable[i]);
return("");
}
//
//
//
//
//
string stringUpperCase(string str) {
string s = str;
for (int length=StringLen(str)-1; length>=0; length--) {
int tchar = StringGetChar(s, length);
if((tchar > 96 && tchar < 123) || (tchar > 223 && tchar < 256))
s = StringSetChar(s, length, tchar - 32);
else if(tchar > -33 && tchar < 0)
s = StringSetChar(s, length, tchar + 224);
}
return(s);
}