Coding help - page 461

 

Hi Mladen, i got the mq4 of an arrow indicator. I have looked through the code myself but I'm not that good that i can spot the problem: The indicator repaints whenever you switch timeframes or reload it.

When you load it on the chart the history looks very good, but in live trading the signals are different. Reload it, and the signals look good again. Could you look into the code and see why it doesn't give the good signals right away? Or at least tweak it to never make it repaint? There has to be something in there that makes the indicator repaint intentionally when you reload or switch timeframes. I have attached the mq4 file: binary_w.mq4

I changed some easy things like arrow styling etc. But the above problem is too hard for a novice like me so any help appreciated

Files:
binary_w.mq4  6 kb
 
wranger:
Hi Mladen, i got the mq4 of an arrow indicator. I have looked through the code myself but I'm not that good that i can spot the problem: The indicator repaints whenever you switch timeframes or reload it.

When you load it on the chart the history looks very good, but in live trading the signals are different. Reload it, and the signals look good again. Could you look into the code and see why it doesn't give the good signals right away? Or at least tweak it to never make it repaint? There has to be something in there that makes the indicator repaint intentionally when you reload or switch timeframes. I have attached the mq4 file: binary_w.mq4

I changed some easy things like arrow styling etc. But the above problem is too hard for a novice like me so any help appreciated

wranger

Do you happen to have the original (non-decompiled) source code of that indicator? f, yes, please posts it so that it can be analysed

 
mladen:
wranger Do you happen to have the original (non-decompiled) source code of that indicator? f, yes, please posts it so that it can be analysed

Thanks for the quick reply. The only other mq4 i have is the original decompiled one.. can't find the real sourcecode mq4 anywhere, i think it's some paid indi that someone decompiled... Attached is the original mq4 i downloaded for what it's worth. So you cant do anything with mq4 files that are decompiled?

binary_indicator.mq4

Files:
 

Hi mladen,

I am trying to get some code for when the Markets are closed or not connected, my thinking is to take the difference between the Broker time and the local time and add a margin to the difference of for example 30 seconds, the thinking is that when the market closes or looses the connection the Broker time stops but the local time keeps on going so once the local time exceeds the Broker time by the set margin it closes down some functions in an EA to stop the chances of a continual order send or modification function I know you can get around this by using start() or OnTick() but in some Equity type EA's I have trading functions using the OnTimer() code so that the orders and trades have little delay and do not rely on the parent chart to update before anything happens and as a result of the OnTimer() code the EA's will attempt to function even when the platform is not connected or the Markets are closed.

I have been going around in circles on this and cannot get anything to work so any help or hints will be much appreciated, but I could be looking at this in totally the wrong way of course and it wouldn't be the first time

 
cja:
Hi mladen,

I am trying to get some code for when the Markets are closed or not connected, my thinking is to take the difference between the Broker time and the local time and add a margin to the difference of for example 30 seconds, the thinking is that when the market closes or looses the connection the Broker time stops but the local time keeps on going so once the local time exceeds the Broker time by the set margin it closes down some functions in an EA to stop the chances of a continual order send or modification function I know you can get around this by using start() or OnTick() but in some Equity type EA's I have trading functions using the OnTimer() code so that the orders and trades have little delay and do not rely on the parent chart to update before anything happens and as a result of the OnTimer() code the EA's will attempt to function even when the platform is not connected or the Markets are closed.

I have been going around in circles on this and cannot get anything to work so any help or hints will be much appreciated, but I could be looking at this in totally the wrong way of course and it wouldn't be the first time

cja

If I understand correctly, why don't you try to use IsConnected() always before trying to execute any order depending function?

As of finding out if the market is closed : ERR_MARKET_CLOSED error will be returned only after the fact (trying to execute some order related operation). You can stop executing the EA for some time after that error, but restarting the terminal or EA will not prevent a new attempt, so, maybe the best way is to hard code (or add as parameter) the market closing time

 

Just checking in for an update on this - as always, thanks for your help............................

Good morning and thanks for your quick response. The page you directed me to has some interesting things in it but is not exactly what I need. Let me better explain....swing 1 of the zig/zag is 60 pips from top to bottom - swing 2 is 44 pips from top to bottom - swing 3 is 106 pips from top to bottom - swing 4 is 86 pips from top to bottom - the current swing is still active and adjusting to price. What I want to do is to have an indicator that will give the average number of pips of the last 4 completed swings as a number displayed on the chart. No need to see the zig/zag indy displayed on chart - just need the average of last "X" swings displayed. In the example above the indicator give me a reading of "74" ( 60+44+106+86 divided by 4 ) Hope this better explains it. Thanks in advance again.

 

Hi, I need help to change this ea. Can someone make this ea only open one trade per bar?

hilobar12.mq4

Files:
hilobar12.mq4  7 kb
 

mladen, about your reply you made for changing this indicator:

https://www.mql5.com/en/forum/174385/page294

mladen:

In cases like that the biggest problem is What would be the criteria for "ranging (the eternal question : when is the market ranging and when is it trending). If you have that criteria, than it is rather easy to apply coloring according to that criteria. But without it, it is a completely different story (in hindsight we can see that easily, but in run time that is quite difficult - if not impossible)

So the question is obvious : what criteria you have in mind (that is quantifiable in mathematical ways) could be used for ranging market determination?

I have found an indicator that looks at the angles of a MA and changes the color accordingly, the problem is, that indicator doesn't work anymore in MQ4. The differenceof of the indicator itself is that it outputs the MA as a histogram, but it is still based on the angles of a MA. Maybe the code to determine the angle of the MA is useful for the XPMA in my original post?

Simple Coding Help - No Promise. - Page 123

So that the color change to yellow is on the MA line itself like you see in my image example of my original post. And what would be even better, is if there is a possibility to change the angle by an extra field in the input screen of the indicator. So that you can choose whether the angle has to be completely flat, or relatively flat, etc. by a number.

 
wranger:
mladen, about your reply you made for changing this indicator:

https://www.mql5.com/en/forum/174385/page294

I have found an indicator that looks at the angles of a MA and changes the color accordingly, the problem is, that indicator doesn't work anymore in MQ4. The differenceof of the indicator itself is that it outputs the MA as a histogram, but it is still based on the angles of a MA. Maybe the code to determine the angle of the MA is useful for the XPMA in my original post?

Simple Coding Help - No Promise. - Page 123

So that the color change to yellow is on the MA line itself like you see in my image example of my original post. And what would be even better, is if there is a possibility to change the angle by an extra field in the input screen of the indicator. So that you can choose whether the angle has to be completely flat, or relatively flat, etc. by a number.

wranger

There is no such thing as angle of average - only approximations

Please read this post : https://www.mql5.com/en/forum/173056/page3 for further details

 
mladen:
wranger

There is no such thing as angle of average - only approximations

Please read this post : https://www.mql5.com/en/forum/173056/page3 for further details

Hi mladen, thanks for pointing me in the right direction. Don't know if my last reply went through but I just downloaded this one:

Forex TSD - forex forum - Download Angle of NonLag MA 1.01.mq4

And this looks like what i was looking for.

However I saw an earlier version from there that had exactly what i had in mind though:

https://www.mql5.com/en/forum/173056/page4 (file Forex TSD - forex forum - Download !!! Angle of average.mq4 )

Unfortunately that doesn't work anymore for the present mt4.... is it possible to make a MA on chart version of this one Forex TSD - forex forum - Download Angle of NonLag MA 1.01.mq4 ?

Reason: