Coding help - page 119

 
Tomcat98:
Hi everyone,

question to coders about "trade conditions":

If I say;

First code:

"

if ( Blah Blah < Blah Blah)

if ( Blah Blah > Blah Blah) result = (OP_SELL);

"

Second code:

"

( Blah Blah Blah Blah) result = (OP_SELL);

"

Is "first code" the same as "second code" ?

In "first code" does the 2 conditions have to be filled altogether or only one to operate a "SELL" ?

Is "Second code" more restrictive?

Can you please en-light me about that?

Sorry for that Blah Blah ... Loooll

Thanks a lot.

Tomcat98

Don't worry about the blah blah Those two code snippets are, all in all, exactly the same. Probably there are some minor differences as far as compiled code is concerned, but as far as execution is concerned they evaluate to exactly the same result. None of the snippets is more restrictive

 
mladen:
Don't worry about the blah blah Those two code snippets are, all in all, exactly the same. Probably there are some minor differences as far as compiled code is concerned, but as far as execution is concerned they evaluate to exactly the same result. None of the snippets is more restrictive

What a prompt answer. Thanks very much for the reply.

I had wonders about these codes, but not anymore now.

I thank you very much Mladen.

Have a good trading week.

Tomcat98

 
TheGMan:
Hi mladen, I had this indicator tweaked a long time ago & I like how it displays now but the only problem is, it now is using up entirely to much CPU. Could you please take a look under the hood & see if maybe the code needs to be cleaned up or see why it freezes my platform when the markets start moving.

It will be greatly appreciated!

Thank you in advance!

G

Hi mladen or mr tools will you look at the code on this one & see if it needs to be cleaned up a bit. It seems to freeze up my platform when the markets start moving fast.

Thanks

G

Files:
 
TheGMan:
Hi mladen or mr tools will you look at the code on this one & see if it needs to be cleaned up a bit. It seems to freeze up my platform when the markets start moving fast.

Thanks

G

TheGMan

That indicator is looking for data from multiple time frames and that is the reason why it slows down your PC. A lot of people complained at it lately (especially since builds 500 and 509 became actual) and it even is maybe a problem that those builds for some reason are causing in that indicator

 
mladen:
TheGMan That indicator is looking for data from multiple time frames and that is the reason why it slows down your PC. A lot of people complained at it lately (especially since builds 500 and 509 became actual) and it even is maybe a problem that those builds for some reason are causing in that indicator

Thank you for the reply mladen,

Such a shame as I really liked that indi & now is almost impossible to use.

G

 
TheGMan:
Thank you for the reply mladen,

Such a shame as I really liked that indi & now is almost impossible to use.

G

It sometimes happen with some builds of metatrader

I remember when iStdDevOnArray() was causing such problems (made indicators using it as slow as a slug) and then they corrected it. If some new build appears, check it again. Who knows : maybe it starts working OK again

 

Problem with a script

Hello,

I have a script, that send three orders in time, with different TP. But sometimes it works, and sometimes there is only the first or first and second order made, but the last one ist gone away to timuktu, or else. I think, three orders send in time can only work, if the server is not to busy.

can anybody help me and change the Script, so that it retries the lost orders new after a few seconds? And is it possibile to make a sound, if a order is executetd?

Thanks a lot

111buy_fps.mq4

Files:
 
effenn:
Hello,

I have a script, that send three orders in time, with different TP. But sometimes it works, and sometimes there is only the first or first and second order made, but the last one ist gone away to timuktu, or else. I think, three orders send in time can only work, if the server is not to busy.

can anybody help me and change the Script, so that it retries the lost orders new after a few seconds? And is it possibile to make a sound, if a order is executetd?

Thanks a lot

111buy_fps.mq4

effenn

Try using this one

Set the retries to a desired number how many times will the script try to open the same order if there is some problem. And set the PauseBetweenRetries to desired number of milliseconds to pause between each new retry to open the order

Files:
buy_fps_2.mq4  3 kb
 

Just joined this wonderfull forum. Found very interesting EA on MT4 forum https://www.mql5.com/en/code/8491. More work needs to be done. I'm not a programmer but think it's duable

Code should be modified in order to read callendar from DailyFX or other source. Maybe something else as well

Any help would be really appreciated.

 

Mladen,The buy and sell part of the above code is not working.the stop is working It doesn't give alert!

mladen:
Try something like this :
static datetime lastAlerted1=0;

static datetime lastAlerted2=0;

static string lastType1="";

static string lastType2="";

//Momentum.....1hour

double mom_1h=iMomentum(NULL,60,14,PRICE_CLOSE,0);

double b4mom_1h=iMomentum(NULL,60,14,PRICE_CLOSE,1);

//========Alerts for buy and Sell==========

//Alerts for buy

if((mom_1h>99.6353)&&(mom_1h>b4mom_1h)&&(lastAlerted1!=Time[0] && lastType1!="Buy")){

lastAlerted1=Time[0];

lastType1="Buy";

Alert("Buy","\n","Current time is ",TimeToStr(CurTime()),"\n",Symbol());

}

//Alerts for Sell

if((mom_1h<100.7482)&&(mom_1h<b4mom_1h)&&(lastAlerted1!=Time[0] && lastType1!="Sell")){

lastAlerted1=Time[0];

lastType1="Sell";

Alert("Sell","\n","Current time is ",TimeToStr(TimeLocal(),TIME_SECONDS),"\n",Sym bol( ));

}

//==========Alerts for Stop buying and sell==============

//Alert to stop Buy

if((mom_1h<b4mom_1h)&&(lastAlerted2!=Time[0]&&lastType2!="Stop Buy")){

lastAlerted2=Time[0];

lastType2="Stop Buy";

Alert("Stop Buy","\n","Current time is ",TimeToStr(CurTime()),"\n",Symbol());

}

//Alerts to Stop Selling

if((mom_1h>b4mom_1h)&&(lastAlerted2!=Time[0]&&lastType2!="Stop Sell")){

lastAlerted2=Time[0];

lastType2="Stop Sell";

Alert(" Stop Sell","\n","Current time is ",TimeToStr(TimeLocal(),TIME_SECONDS),"\n",Sym bol( ));

}

Reason: