- หน้าหลัก
- ชุมชน
- การเขียนโปรแกรม
- Free Indicator Opportunity!!!
Edit Your Comment
Free Indicator Opportunity!!!
เป็นสมาชิกตั้งแต่ Jun 09, 2020
1 โพสต์
เป็นสมาชิกตั้งแต่ May 21, 2020
9 โพสต์
Jul 30, 2020 at 14:23
เป็นสมาชิกตั้งแต่ May 21, 2020
9 โพสต์
I am looking for a time based volume indicator for MT4 platform.
Time based in terms of historical volume at specific times in the past relative to the current volume. An example the volume on a 15 minute chart now as compared to the same 15 minute period over the last month or two.
The idea I have is to take the mean of the set of 15 minute historical time frames and then compare the current volume to the historical volume for the 15 minute time frame. The concept is to determine whether the current volume is greater or less than the historical volume during the same time frame.
Any help would be greatly appreciated.
Time based in terms of historical volume at specific times in the past relative to the current volume. An example the volume on a 15 minute chart now as compared to the same 15 minute period over the last month or two.
The idea I have is to take the mean of the set of 15 minute historical time frames and then compare the current volume to the historical volume for the 15 minute time frame. The concept is to determine whether the current volume is greater or less than the historical volume during the same time frame.
Any help would be greatly appreciated.
Aug 16, 2020 at 16:16
เป็นสมาชิกตั้งแต่ May 21, 2020
18 โพสต์
Do you sell your strategies? Or is it important for you to test it and understand how well it allows you to earn?
Actually, I would like to see real indicators, which will show that it makes sense. And of course on a real account... Not on a demo...
Actually, I would like to see real indicators, which will show that it makes sense. And of course on a real account... Not on a demo...
Aug 23, 2020 at 06:28
เป็นสมาชิกตั้งแต่ Aug 07, 2017
2 โพสต์
nice sir , plz code for me indicator, [email protected]
เป็นสมาชิกตั้งแต่ Oct 01, 2020
4 โพสต์
เป็นสมาชิกตั้งแต่ May 21, 2020
9 โพสต์
Oct 15, 2020 at 18:26
เป็นสมาชิกตั้งแต่ May 21, 2020
9 โพสต์
I do not have a sample of the time based volume indicator.
I only had an idea, which consisted of developing a base line to judge the current volume by the volume at the same time of day over a specific time frame. I could then better judge whether the current volume is above or below average during the same time frame. So it really comes down to is the current bar's volume is above or below the average for the same bar at that specific time over the last 4 to 6 weeks.
I only had an idea, which consisted of developing a base line to judge the current volume by the volume at the same time of day over a specific time frame. I could then better judge whether the current volume is above or below average during the same time frame. So it really comes down to is the current bar's volume is above or below the average for the same bar at that specific time over the last 4 to 6 weeks.
เป็นสมาชิกตั้งแต่ May 21, 2020
9 โพสต์
Oct 20, 2020 at 17:29
เป็นสมาชิกตั้งแต่ May 21, 2020
9 โพสต์
Can you explain why there are vertical lines when this indicator is attached to 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<limit; i++)
{
UpTicks[i]=(Volume[i]+(Close[i]-Open[i])/Point)/2;
DownTicks[i]=Volume[i]-UpTicks[i];
Diff[i]=UpTicks[i]-DownTicks[i];
}
//---
double ExCRate=1; //Assume Account is same as counter so ExCRate=1
AccntC=AccountCurrency(); //Currency of Acount eg USD,GBP,EUR
CounterC=StringSubstr(Symbol(),3,3); //The Count Currency eg GBPUSD is USD
ExC=AccntC+CounterC; //Create the Pair for account eg USDGBP
if(AccntC!=CounterC)
ExCRate= MarketInfo(ExC,MODE_ASK); //Get the correct FX rate for the Account to Counter conversion
if(ExCRate ==0) ExCRate=1.0;
double ATRPoints=iATR(NULL,0,InpATRperiod,0); //Get the ATR in points to calc SL and TP
double riskVAccntC=AccountEquity()*(InpRisk/100);
double riskvalue=(ExCRate/1)*riskVAccntC; //Risk in Account Currency
double slpoints=(ATRPoints*InpSLfactor); //Risk in Counter Currency
double riskperpoint=(riskvalue/slpoints)*Point;
double lotSize=riskperpoint; //Risk in currency per point
int pipMult=10000;
if(CounterC=='JPY') {
lotSize=riskperpoint/100;
pipMult=100;
}
double ATRpips=MathCeil(pipMult*ATRPoints);
ObjectSetString(ChartID(),'textATR',OBJPROP_TEXT,StringFormat('ATR(%.0f):%.0f %s', InpATRperiod,ATRpips,'pips'));
ObjectSetString(ChartID(),'textBAL',OBJPROP_TEXT,StringFormat('Equity:%.2f%s',AccountEquity(),AccntC));
ObjectSetString(ChartID(),'textRISK',OBJPROP_TEXT,StringFormat('Risk %.1f%%:%.0f %s',InpRisk,riskVAccntC,AccntC));
ObjectSetString(ChartID(),'textlotsize',OBJPROP_TEXT,StringFormat('Lot Size At 1.5 Of ATR :%.2f',lotSize));
//ObjectSetString(ChartID(),'textBuyVolume',OBJPROP_TEXT,StringFormat('Buy Volume:%.2f',UpTicks[0]));
ObjectSetString(ChartID(),'textBuyVolume',OBJPROP_TEXT,StringFormat('Buy Volume:%.2f',UpTicks[0]));
ObjectSetString(ChartID(),'textSellVolume',OBJPROP_TEXT,StringFormat('Sell Volume:%.2f',DownTicks[0]));
ObjectSetString(ChartID(),'textDifference',OBJPROP_TEXT,StringFormat('Difference:%.2f',Diff[0]));
//--- forced chart redraw
ChartRedraw(ChartID());
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
ObjectDelete('textATR');
ObjectDelete('textBAL');
ObjectDelete('textRISK');
ObjectDelete('textlotsize');
ObjectDelete('textBuyVolume');
ObjectDelete('textSellVolume');
}
//Function to create a text field in the main Window
// Example call --- text_init(ChartID(),'textATR',1000,30,clrRed,12);
int text_init(const long current_chart_id,const string obj_label,const int x_dist,const int y_dist,const int text_color,const int font_size)
{
//--- creating label object (it does not have time/price coordinates)
if(!ObjectCreate(current_chart_id,obj_label,OBJ_LABEL,0,0,0))
{
Print('Error: can't create label! code #',GetLastError());
return(0);
}
//--- set distance property
ObjectSet(obj_label,OBJPROP_CORNER,InpBaseCorner);
ObjectSet(obj_label,OBJPROP_XDISTANCE,x_dist);
ObjectSet(obj_label,OBJPROP_YDISTANCE,y_dist);
ObjectSetInteger(current_chart_id,obj_label,OBJPROP_COLOR,text_color);
ObjectSet(obj_label,OBJPROP_FONTSIZE,font_size);
return(0);
}
//+------------------------------------------------------------------+
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<limit; i++)
{
UpTicks[i]=(Volume[i]+(Close[i]-Open[i])/Point)/2;
DownTicks[i]=Volume[i]-UpTicks[i];
Diff[i]=UpTicks[i]-DownTicks[i];
}
//---
double ExCRate=1; //Assume Account is same as counter so ExCRate=1
AccntC=AccountCurrency(); //Currency of Acount eg USD,GBP,EUR
CounterC=StringSubstr(Symbol(),3,3); //The Count Currency eg GBPUSD is USD
ExC=AccntC+CounterC; //Create the Pair for account eg USDGBP
if(AccntC!=CounterC)
ExCRate= MarketInfo(ExC,MODE_ASK); //Get the correct FX rate for the Account to Counter conversion
if(ExCRate ==0) ExCRate=1.0;
double ATRPoints=iATR(NULL,0,InpATRperiod,0); //Get the ATR in points to calc SL and TP
double riskVAccntC=AccountEquity()*(InpRisk/100);
double riskvalue=(ExCRate/1)*riskVAccntC; //Risk in Account Currency
double slpoints=(ATRPoints*InpSLfactor); //Risk in Counter Currency
double riskperpoint=(riskvalue/slpoints)*Point;
double lotSize=riskperpoint; //Risk in currency per point
int pipMult=10000;
if(CounterC=='JPY') {
lotSize=riskperpoint/100;
pipMult=100;
}
double ATRpips=MathCeil(pipMult*ATRPoints);
ObjectSetString(ChartID(),'textATR',OBJPROP_TEXT,StringFormat('ATR(%.0f):%.0f %s', InpATRperiod,ATRpips,'pips'));
ObjectSetString(ChartID(),'textBAL',OBJPROP_TEXT,StringFormat('Equity:%.2f%s',AccountEquity(),AccntC));
ObjectSetString(ChartID(),'textRISK',OBJPROP_TEXT,StringFormat('Risk %.1f%%:%.0f %s',InpRisk,riskVAccntC,AccntC));
ObjectSetString(ChartID(),'textlotsize',OBJPROP_TEXT,StringFormat('Lot Size At 1.5 Of ATR :%.2f',lotSize));
//ObjectSetString(ChartID(),'textBuyVolume',OBJPROP_TEXT,StringFormat('Buy Volume:%.2f',UpTicks[0]));
ObjectSetString(ChartID(),'textBuyVolume',OBJPROP_TEXT,StringFormat('Buy Volume:%.2f',UpTicks[0]));
ObjectSetString(ChartID(),'textSellVolume',OBJPROP_TEXT,StringFormat('Sell Volume:%.2f',DownTicks[0]));
ObjectSetString(ChartID(),'textDifference',OBJPROP_TEXT,StringFormat('Difference:%.2f',Diff[0]));
//--- forced chart redraw
ChartRedraw(ChartID());
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
ObjectDelete('textATR');
ObjectDelete('textBAL');
ObjectDelete('textRISK');
ObjectDelete('textlotsize');
ObjectDelete('textBuyVolume');
ObjectDelete('textSellVolume');
}
//Function to create a text field in the main Window
// Example call --- text_init(ChartID(),'textATR',1000,30,clrRed,12);
int text_init(const long current_chart_id,const string obj_label,const int x_dist,const int y_dist,const int text_color,const int font_size)
{
//--- creating label object (it does not have time/price coordinates)
if(!ObjectCreate(current_chart_id,obj_label,OBJ_LABEL,0,0,0))
{
Print('Error: can't create label! code #',GetLastError());
return(0);
}
//--- set distance property
ObjectSet(obj_label,OBJPROP_CORNER,InpBaseCorner);
ObjectSet(obj_label,OBJPROP_XDISTANCE,x_dist);
ObjectSet(obj_label,OBJPROP_YDISTANCE,y_dist);
ObjectSetInteger(current_chart_id,obj_label,OBJPROP_COLOR,text_color);
ObjectSet(obj_label,OBJPROP_FONTSIZE,font_size);
return(0);
}
//+------------------------------------------------------------------+
*การใช้งานเชิงพาณิชย์และสแปมจะไม่ได้รับการยอมรับ และอาจส่งผลให้บัญชีถูกยกเลิก
เคล็ดลับ: การโพสต์รูปภาพ/youtube url จะฝังลงในโพสต์ของคุณโดยอัตโนมัติ!
เคล็ดลับ: พิมพ์เครื่องหมาย @ เพื่อป้อนชื่อผู้ใช้ที่เข้าร่วมการสนทนานี้โดยอัตโนมัติ