Coding help - page 95

 

Dear All, that my first step into a post about forex, so please try to be kind if I say something too wrong...

This website is one of the best place to learn about forex and I am reading about since a couple of years. I would like to put attention on this link:codebase.mql4.com/5900

The ea is RUBBERBANDS_2 EA by Author: StJojo (2009.08.17 11:30). It's quite interesting the way it works, (after a minimum optimizing work) on any currency pair. Basically it could be used as a (allow me the expression..) semiautomatic automated startegy. Infact, because it works very well on sideways market, I discovered that could be activated in News intervals when the probability of sideway market are higher. Because I think that the code is made opensource by the author, I would like, if anyone like the idea, to add the variable to make it works from a certain hour/minutes to "quiesce" at a certain time/hour/minutes (i.e. :to quiesce this EA when the current session ends). This would facilitate much more the "preprogramming" work time of the ea for the day after, relatively the next days upcoming News. I attached the file as from the link above.

I attached as well the "forex_ news_market_clock" indicators that is the one I use to read the new on the chart.

Thank everyone for the work made in this site (and all over the net... of course). Hope someone would help,many thanks.

 
vitoingletto:
Dear All, that my first step into a post about forex, so please try to be kind if I say something too wrong...

This website is one of the best place to learn about forex and I am reading about since a couple of years. I would like to put attention on this link:codebase.mql4.com/5900

The ea is RUBBERBANDS_2 EA by Author: StJojo (2009.08.17 11:30). It's quite interesting the way it works, (after a minimum optimizing work) on any currency pair. Basically it could be used as a (allow me the expression..) semiautomatic automated startegy. Infact, because it works very well on sideways market, I discovered that could be activated in News intervals when the probability of sideway market are higher. Because I think that the code is made opensource by the author, I would like, if anyone like the idea, to add the variable to make it works from a certain hour/minutes to "quiesce" at a certain time/hour/minutes (i.e. :to quiesce this EA when the current session ends). This would facilitate much more the "preprogramming" work time of the ea for the day after, relatively the next days upcoming News. I attached the file as from the link above.

I attached as well the "forex_ news_market_clock" indicators that is the one I use to read the new on the chart.

Thank everyone for the work made in this site (and all over the net... of course). Hope someone would help,many thanks.

Hello Vitoingletto,

Thanks for the EA,added a time filter and a close on Friday function and also a magic number to help the EA differentiate between orders somewhat.

 

hello ...

ways wonder if you can put in the code the function that exports data directly all at once (m1, m5, m30, m15, h1, h4, d1 ...) obviously in separate files. Currently the and you have to start it so many times ... (for each tmeframe).

I would have a substantial savings of time to export the data.

You can insert this function in your code? an idea may be similar to this attached script (Period_converter_auto - MQL4 Code Base), which transforms the data all in one volta.Si can play in the expert?

thanks

 
dr.feelgood1989:
hello ...

ways wonder if you can put in the code the function that exports data directly all at once (m1, m5, m30, m15, h1, h4, d1 ...) obviously in separate files. Currently the and you have to start it so many times ... (for each tmeframe).

I would have a substantial savings of time to export the data.

You can insert this function in your code? an idea may be similar to this attached script (Period_converter_auto - MQL4 Code Base), which transforms the data all in one volta.Si can play in the expert?

thanks

dr.feelgood1989

Use this one and simply attach it to all time frames you wish to have exported. It will make a files named symbol+"_"+time frame for each time frame you look at. You can use it as a template for your custom indicators exports

Files:
 

thanks for the reply .. Mladen

actually I was already so. The script (reference example) that I posted gets the job once for all timeframes (conversion).

the expert from her modified "rewrite" a single timeframe (to distinguish the file) when it is used for single time

I was wondering if starting a single expert is rewritten all other timeframes (example:ea1m started on the tester and also the files are written in other timeframes m5, m15 ...)

thanks : )

 
mladen:
pgtips,

What does you main loop look like (or post a code where you are attempting to do that)

PS: You have to change the last parameter of iOpen() and iClose() to point to the correct day for a chosen bar

Hello Mladen,

I got quite stuck with this so looked to try other way of doing the same.

I found this indicator attached after several days of search which is close to what I need but it has been made different.

It displays current candle (from daily) but there is no iopen/close variable to select to display back one day i.e shift -1

Could you tell me how I might make this have a shift for back x days. ? So if prev day bar was red then make current box red, if prev green then current box green.

I can overlay the breakout box indicator on top of this but it would be really good if this one could be limited by time.

I understand you are busy and give your time for free but if you could help I would really appreciate it.

Many thanks

PG

Files:
 

Hi,

I'm still chipping away at this.

In the attached I have managed to use pivot indicator to get me colour change per day based on previous day close i.e prev day green day or red.

Now I need to make rectangle and fill it based on the period I want to see it displayed time of 11.00 am to say 17.00pm, the high and low being whatever it turns out to be during that time.

I set //

ObjectCreate("Rectangle", OBJ_RECTANGLE, 0, Time[periodBegin], Low[1], Time[periodEnd], High[1]);

but got error, nothing displays at all.

extern int periodBegin = 11; //11:00 am

extern int periodEnd = 17; // 17:00 pm

I set extern bool Plot_rectangles=true; so it 'should' plot something for each day.

What am I missing here?

Thank you

PG

Files:
 

I think I know the answer to my question, but... still want confirm

a. indicator is higher time frame

b. is current time frame.

like I would like to using a as based trend b. as entry can this be done?

 
mtuppers:
I think I know the answer to my question, but... still want confirm

a. indicator is higher time frame

b. is current time frame.

like I would like to using a as based trend b. as entry can this be done?

Yes you can.

Simply call a with higher time frame in the timeFrame parameter and that is all. To avoid backtesting traps of multi time frame EA, use closed bar on multi time frame indicator (index 1 instead of 0) otherwise you will get unrealistically good result due to how metatrader calls other than current time time frames in back-testing

 

hello,

I hope you can help me with this. I want the dots(arrows; aqua&yellow) of the indi in window two to show as dots(arrows) on the close(or high for buy signal/low for sell signal) in window one(the main chart window). I tried for hours, but I will never be a coder ;-)

#property indicator_separate_window

#property indicator_minimum -100.0

#property indicator_maximum 100.0

#property indicator_levelcolor SlateGray

#property indicator_levelstyle 1

#property indicator_buffers 8

#property indicator_color1 Lime

#property indicator_color2 Red

#property indicator_color3 Black

#property indicator_color4 Black

#property indicator_color5 Black

#property indicator_color6 Black

#property indicator_color7 Aqua

#property indicator_color8 Yellow

#property indicator_width1 1

#property indicator_level1 60.0

#property indicator_width2 1

#property indicator_level2 50.0

#property indicator_level3 -50.0

#property indicator_level4 -60.0

extern int WavePeriod = 10;

extern int AvgPeriod = 21;

extern bool SoundAlert = FALSE;

extern bool EmailAlert = FALSE;

double g_ibuf_92[];

double g_ibuf_96[];

double g_ibuf_100[];

double g_ibuf_104[];

double g_ibuf_108[];

double g_ibuf_112[];

double g_ibuf_116[];

double g_ibuf_120[];

int gi_124 = -50;

int gi_128 = 50;

int gi_132;

int init() {

IndicatorShortName("TrendWave");

SetIndexBuffer(0, g_ibuf_100);

SetIndexLabel(0, "ESA");

SetIndexStyle(0, DRAW_NONE);

SetIndexDrawBegin(0, 0);

SetIndexBuffer(1, g_ibuf_112);

SetIndexLabel(1, "DD Values");

SetIndexStyle(1, DRAW_NONE);

SetIndexDrawBegin(1, 0);

SetIndexBuffer(2, g_ibuf_104);

SetIndexLabel(2, "DD");

SetIndexStyle(2, DRAW_NONE);

SetIndexDrawBegin(2, 0);

SetIndexBuffer(3, g_ibuf_108);

SetIndexLabel(3, "CI");

SetIndexStyle(3, DRAW_NONE);

SetIndexDrawBegin(3, 0);

SetIndexBuffer(4, g_ibuf_92);

SetIndexLabel(4, "Bull");

SetIndexStyle(4, DRAW_LINE, STYLE_SOLID, 1, Lime);

SetIndexDrawBegin(4, 0);

SetIndexBuffer(5, g_ibuf_96);

SetIndexLabel(5, "Bear");

SetIndexStyle(5, DRAW_LINE, STYLE_SOLID, 1, Red);

SetIndexDrawBegin(5, 0);

SetIndexBuffer(6, g_ibuf_116);

SetIndexLabel(6, "Buy Dot");

SetIndexStyle(6, DRAW_ARROW, STYLE_SOLID, 2, Aqua);

SetIndexArrow(6, 108);

SetIndexDrawBegin(6, 0);

SetIndexBuffer(7, g_ibuf_120);

SetIndexLabel(7, "Sell Dot");

SetIndexStyle(7, DRAW_ARROW, STYLE_SOLID, 2, Yellow);

SetIndexArrow(7, 108);

SetIndexDrawBegin(7, 0);

ArrayResize(g_ibuf_100, Bars);

ArrayResize(g_ibuf_112, Bars);

ArrayResize(g_ibuf_104, Bars);

ArrayResize(g_ibuf_108, Bars);

ArrayResize(g_ibuf_92, Bars);

ArrayResize(g_ibuf_96, Bars);

ArrayResize(g_ibuf_116, Bars);

ArrayResize(g_ibuf_120, Bars);

return (0);

}

int start() {

double l_ima_on_arr_0;

int li_12 = IndicatorCounted();

if (li_12 < 0) return (-1);

if (li_12 > 0) li_12--;

int li_8 = Bars - li_12;

for (int li_16 = li_8; li_16 > 0; li_16--) {

g_ibuf_100[li_16] = iMA(NULL, 0, WavePeriod, 0, MODE_EMA, PRICE_TYPICAL, li_16);

ArraySetAsSeries(g_ibuf_100, TRUE);

}

for (li_16 = li_8; li_16 > 0; li_16--) {

g_ibuf_112[li_16] = MathAbs((iHigh(NULL, 0, li_16) + iClose(NULL, 0, li_16) + iLow(NULL, 0, li_16)) / 3.0 - g_ibuf_100[li_16]);

ArraySetAsSeries(g_ibuf_112, TRUE);

}

for (li_16 = li_8; li_16 > 0; li_16--) {

l_ima_on_arr_0 = iMAOnArray(g_ibuf_112, 0, WavePeriod, 0, MODE_EMA, li_16);

g_ibuf_104[li_16] = l_ima_on_arr_0;

ArraySetAsSeries(g_ibuf_104, TRUE);

}

for (li_16 = li_8; li_16 > 0; li_16--) {

if (g_ibuf_104[li_16] > 0.0) g_ibuf_108[li_16] = ((iHigh(NULL, 0, li_16) + iClose(NULL, 0, li_16) + iLow(NULL, 0, li_16)) / 3.0 - g_ibuf_100[li_16]) / (0.015 * g_ibuf_104[li_16]);

else g_ibuf_108[li_16] = 0;

ArraySetAsSeries(g_ibuf_108, TRUE);

}

for (li_16 = li_8; li_16 > 0; li_16--) {

l_ima_on_arr_0 = iMAOnArray(g_ibuf_108, 0, AvgPeriod, 0, MODE_EMA, li_16);

g_ibuf_92[li_16] = l_ima_on_arr_0;

ArraySetAsSeries(g_ibuf_92, TRUE);

}

for (li_16 = li_8; li_16 > 0; li_16--) {

l_ima_on_arr_0 = iMAOnArray(g_ibuf_92, 0, 4, 0, MODE_SMA, li_16);

g_ibuf_96[li_16] = l_ima_on_arr_0;

ArraySetAsSeries(g_ibuf_96, TRUE);

}

for (li_16 = li_8; li_16 > 0; li_16--) {

if (g_ibuf_92[li_16] >= g_ibuf_96[li_16] && g_ibuf_92[li_16 + 1] <= g_ibuf_96[li_16 + 1] && g_ibuf_92[li_16] < gi_124) {

g_ibuf_116[li_16] = g_ibuf_92[li_16];

SendAlert("buy");

} else g_ibuf_116[li_16] = -1000;

if (g_ibuf_92[li_16] = g_ibuf_96[li_16 + 1] && g_ibuf_92[li_16] > gi_128) {

g_ibuf_120[li_16] = g_ibuf_96[li_16];

SendAlert("sell");

} else g_ibuf_120[li_16] = -1000;

}

return (0);

}

void SendAlert(string as_0) {

if (Time[0] != gi_132) {

if (SoundAlert) {

if (as_0 == "buy") Alert(Symbol() + " => " + TimeToStr(TimeCurrent()) + " buy");

if (as_0 == "sell") Alert(Symbol() + " => " + TimeToStr(TimeCurrent()) + " sell");

}

if (EmailAlert) {

if (as_0 == "buy") SendMail("TrendWave Alert", Symbol() + " => " + TimeToStr(TimeCurrent()) + " buy");

if (as_0 == "sell") SendMail("TrendWave Alert", Symbol() + " => " + TimeToStr(TimeCurrent()) + " sell");

}

gi_132 = Time[0];

}

}

Reason: