.

Coding help ...

Moderators: mrtools, mntiwana

Re: Coding help ...

#881
Hi Mladen, I have a problem with an indicator, it's called madistance and it's repaint so I can not use it well, can you fix it?
Attachments
Ma distance.jpg
MaDistance.mq4
(3.73 KiB) Downloaded 22 times


Re: Coding help ...

#882
Daniele wrote:
Tue Dec 04, 2018 5:12 am
Hi Mladen, I have a problem with an indicator, it's called madistance and it's repaint so I can not use it well, can you fix it?
Try this version.
Attachments
Ma Distance.mq4
(3.16 KiB) Downloaded 36 times

Re: Coding help ...

#883
mrtools wrote:
Tue Dec 04, 2018 7:21 am
Daniele wrote:
Tue Dec 04, 2018 5:12 am
Hi Mladen, I have a problem with an indicator, it's called madistance and it's repaint so I can not use it well, can you fix it?
Try this version.
Hi mrtools, thanks, the version you entered is better because if I leave the indicator in a specific timeframe without changing it then does not make any repaint but if I change the timeframe and then go back to the previous timeframe the indicator makes repaint, you can fix also this detail?

Re: Coding help ...

#884
Daniele wrote:
Wed Dec 05, 2018 1:29 am
mrtools wrote:
Tue Dec 04, 2018 7:21 am


Try this version.
Hi mrtools, thanks, the version you entered is better because if I leave the indicator in a specific timeframe without changing it then does not make any repaint but if I change the timeframe and then go back to the previous timeframe the indicator makes repaint, you can fix also this detail?
From what i can tell from the code the only way the oscillator can repaint if you are using a negative shift.

Re: Coding help ...

#885
mrtools wrote:
Wed Dec 05, 2018 2:15 am
Daniele wrote:
Wed Dec 05, 2018 1:29 am


Hi mrtools, thanks, the version you entered is better because if I leave the indicator in a specific timeframe without changing it then does not make any repaint but if I change the timeframe and then go back to the previous timeframe the indicator makes repaint, you can fix also this detail?
From what i can tell from the code the only way the oscillator can repaint if you are using a negative shift.

But if I put the indicator on m1 and then move to another timeframe and return immediately on m1 the values ​​of the yellow line will be different so I am forced not to change the timeframe.


Re: Coding help ...

#886
mrtools wrote:
Wed Dec 05, 2018 2:15 am
Daniele wrote:
Wed Dec 05, 2018 1:29 am


Hi mrtools, thanks, the version you entered is better because if I leave the indicator in a specific timeframe without changing it then does not make any repaint but if I change the timeframe and then go back to the previous timeframe the indicator makes repaint, you can fix also this detail?
From what i can tell from the code the only way the oscillator can repaint if you are using a negative shift.

I have to give an update about the repaint, I saw that it makes repaint even if I leave the indicator stationary in a single timeframe so you can not use it well. The first image is this morning and the second image I created it now and you can see that the values ​​are not the same as this morning's image.
Attachments
ma distance 2.png
ma distance 3.png

Re: Coding help ...

#887
Dear Sir,
I have quection how to increased the order???
EX: this EA only open 1 trade, but i want to open more trades (3 orders) at same time.
Thanks.


extern double Lots = 0.01;

extern int StopLoss = 300;

extern int TakeProfit = 50;

int g_bars_92;

bool gi_96 = TRUE;



int init() {

if (Digits == 3 || Digits == 5) {

StopLoss = StopLoss;

TakeProfit = TakeProfit;

}

return (0);

}



int deinit() {

return (0);

}



int start() {

if (g_bars_92 < Bars && TOOC() == 0 && g_bars_92 != 0 && gi_96) OrderSend(Symbol(), OP_BUY, Lots, Ask, 0, Bid - StopLoss * Point, Ask + TakeProfit * Point, 0, 0, 0, Red);

g_bars_92 = Bars;

if (TOOC() == 1) gi_96 = FALSE;

Comment("Error: ", GetLastError());

return (0);

}



int TOOC() {

int li_ret_0;

for (int l_pos_4 = 0; l_pos_4 < OrdersTotal(); l_pos_4++) {

if (OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES))

if (OrderSymbol() == Symbol()) li_ret_0++;

}

return (li_ret_0);}



}

Re: Coding help ...

#888
hock87 wrote:
Wed Dec 05, 2018 12:09 pm
Dear Sir,
I have quection how to increased the order???
EX: this EA only open 1 trade, but i want to open more trades (3 orders) at same time.
Thanks.


extern double Lots = 0.01;

extern int StopLoss = 300;

extern int TakeProfit = 50;

int g_bars_92;

bool gi_96 = TRUE;



int init() {

if (Digits == 3 || Digits == 5) {

StopLoss = StopLoss;

TakeProfit = TakeProfit;

}

return (0);

}



int deinit() {

return (0);

}



int start() {

if (g_bars_92 < Bars && TOOC() == 0 && g_bars_92 != 0 && gi_96) OrderSend(Symbol(), OP_BUY, Lots, Ask, 0, Bid - StopLoss * Point, Ask + TakeProfit * Point, 0, 0, 0, Red);

g_bars_92 = Bars;

if (TOOC() == 1) gi_96 = FALSE;

Comment("Error: ", GetLastError());

return (0);

}



int TOOC() {

int li_ret_0;

for (int l_pos_4 = 0; l_pos_4 < OrdersTotal(); l_pos_4++) {

if (OrderSelect(l_pos_4, SELECT_BY_POS, MODE_TRADES))

if (OrderSymbol() == Symbol()) li_ret_0++;

}

return (li_ret_0);}



}
That looks like decompiled code. Have no idea!

Re: Coding help ...

#889
mrtools wrote:
Wed Dec 05, 2018 2:15 am
Daniele wrote:
Wed Dec 05, 2018 1:29 am


Hi mrtools, thanks, the version you entered is better because if I leave the indicator in a specific timeframe without changing it then does not make any repaint but if I change the timeframe and then go back to the previous timeframe the indicator makes repaint, you can fix also this detail?
From what i can tell from the code the only way the oscillator can repaint if you are using a negative shift.

Hello mrtools, now I understand the problem of repaint, if you look at the post where I entered the 2 images you can see that the yellow line does not change then does not repaint but the red lines make the repaint, you think you can arrange the red lines ?

Re: Coding help ...

#890
Daniele wrote:
Fri Dec 07, 2018 4:17 am
mrtools wrote:
Wed Dec 05, 2018 2:15 am


From what i can tell from the code the only way the oscillator can repaint if you are using a negative shift.

Hello mrtools, now I understand the problem of repaint, if you look at the post where I entered the 2 images you can see that the yellow line does not change then does not repaint but the red lines make the repaint, you think you can arrange the red lines ?
Think this is what they were trying to do but not sure.
Attachments
EURUSDH1.png
Ma Distance + bands.mq4
(2.94 KiB) Downloaded 18 times


Who is online

Users browsing this forum: CommonCrawl [Bot] and 1 guest