| / | Forum |
|
fx_trader
2007.01.22 01:28
Hello experts,
I´ve been trying to develop my own expert but it is harder than I thought. What I want is this: I want the expert to calculate the average bar size of the last 15 periods, if the last bar is larger than the average and it is a bull bar then color it in blue, if it is a bear bar color it in red. The size of each bar is calculated measuring the high and the low of each bar, for instance, high: 1.2340 low: 1.2328, then the size of that bar would be 12 pips. I believe programming this expert is easy, I am just not a good programmer. Any help will be greatly appreciated. Regards, fx_trader |
|
Automated Trading Championship 2008 Has Started! Today, on the 1st of October 2008, the Automated Trading Championship 2008 has started! 705 Expert Advisors toed the starting line. |
|
fx_trader
2007.01.23 17:41
Any ideas?
I appreciate your help |
|
JosTheelen
2007.01.23 18:00
As far as I know, it is difficult to change colors of bars or candlesticks. Your calculations seem to be easy, but redrawing bars/candlesticks is a problem. |
|
fx_trader
2007.01.23 23:55
Hello JosTheelen,
Thank you very much for your response. I see, and how about an arrow to indicate the cadndlestick is larger than the average? Thank you again for your help. Regards, FX_trader |
|
fx_trader
2007.02.06 19:56
fx_trader wrote: Hello JosTheelen, Thank you very much for your response. I see, and how about an arrow to indicate the cadndlestick is larger than the average? Thank you again for your help. Regards, FX_trader |
|
fx_trader
2007.02.06 19:57
Hello back
Anyone willing to help me? fx_trader |
|
JosTheelen
2007.02.06 22:47
fx_trader wrote: I will look at it these days. Is the last bar part of those 15 periods or just the
16'th?Hello back Anyone willing to help me? fx_trader |
|
JosTheelen
2007.02.12 13:21
JosTheelen wrote: I will look at it these days. Is the last bar part of those 15 periods or just the 16'th? No response?? |
33779 |
Rosh
2007.02.12 14:16
Average of (High - Low) == Average(High)-Average(Low)
Thus, we having this simple indicator: //+------------------------------------------------------------------+ //| BarSize.mq4 | //| Copyright © 2007, MetaQuotes Software Corp. | //| http://www.metaquotes.net | //+------------------------------------------------------------------+ #property copyright "Copyright © 2007, MetaQuotes Software Corp." #property link "http://www.metaquotes.net" #property indicator_chart_window #property indicator_buffers 4 #property indicator_color1 Red #property indicator_color2 Blue #property indicator_color3 Red #property indicator_color4 Blue //---- input parameters extern int ParamPer=15; //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_HISTOGRAM,STYLE_SOLID,3); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(1,DRAW_HISTOGRAM,STYLE_SOLID,3); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_HISTOGRAM); SetIndexBuffer(2,ExtMapBuffer3); SetIndexStyle(3,DRAW_HISTOGRAM); SetIndexBuffer(3,ExtMapBuffer4); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); //---- int i,limit; double AvereageCandle; if (counted_bars==0) limit=Bars-ParamPer; if (counted_bars>0) limit=Bars-counted_bars; limit--; for (i=limit;i>=0;i--) { AvereageCandle=iMA(NULL,0,ParamPer,0,MODE_SMA,PRICE_HIGH,1)-iMA(NULL,0,ParamPer,0,MODE_SMA,PRICE_LOW,1); if (High[i]-Low[i]>AvereageCandle) { if (Close[i]>Open[i]) { ExtMapBuffer1[i]=Open[i]; ExtMapBuffer2[i]=Close[i]; ExtMapBuffer3[i]=Low[i]; ExtMapBuffer4[i]=High[i]; } else { ExtMapBuffer1[i]=Open[i]; ExtMapBuffer2[i]=Close[i]; ExtMapBuffer3[i]=High[i]; ExtMapBuffer4[i]=Low[i]; } } } //---- return(0); } //+------------------------------------------------------------------+ ![]() |
|
JosTheelen
2007.02.12 17:53
Thanks Rosh. I thought it was difficult to redraw those bars, but it seems easy
to do.
|