How to code? - page 133

 
bkr1969:
I can't use magic number because I'm running the same EA on 8 different pairs. Where is my original post so I can follow it?

If a post is moved is for some reason, like maintain forum order.

Your posts where moved (to this thread) but you could follow easily because they have one day of redirection.

Maybe you need a bit of help trying to find your own posts.

If you feel lost, with vBulletin is not difficult at all. Just click on your own profile, "find all posts by..."

 

Instant Order vs Market Orders

Hello Fellow Programmers,

I received information from a friend that an EA with "Instant orders" will not work on the MT4 platforms that doesn't have a Dealing desk and this EA needs to be changed to "Market Orders". Is it true? Can someone verify this?

Thanks.

LF

 

They're the same thing.

Lux

 
luxinterior:
They're the same thing. Lux

Are they? Hmmm...My friend was advised by the Broker to do just that; Change from "Instant" to "Market" Thanks.

Anyone else have different view?

LF

 

Thanks to FerruFx

FerruFx:
An idea would be to not allow trading after the first order of the day. After the ordersend() function, place a "trade = false;"

Then reset the trade allowance each new day:

if(timeprev!=iTime(Symbol(),PERIOD_D1,0)) { //---- This is a new day

timeprev = iTime(Symbol(),PERIOD_D1,0);

trade = true; }

Then when you check your signal:

if(trade) { your trading condition here }

Just an example ...

FerruFx

Thanks FerruFx. I will code this and hope it will now run.

fxbeginner

 
fxbeginner:
Thanks FerruFx. I will code this and hope it will now run. fxbeginner

You're welcome.

FerruFx

 

Account History Problem

Hello All,

I have programmed an EA that uses Limit orders instead of Market orders. Whenever a moving average changes, it uses the OrderModify function to alter the opening price of the order.

This works fine, however each time the order is adjusted (fairly frequently) the Account History has a new entry saying the order has been closed. This almost hides the real trades and the reports are very hard to read. Is there a method of customising the reports or account history so that it will only show the actual trades that have taken place, rather than "modified" orders?

Thanks for any replies

 

Buy at open of next bar

Hello everyone,

Would someone be able to provide some sample code on how to do this? I need to check if the bar is complete and if it is then place the order.

This is greatly appreciated.

 
callan300:
Hello everyone,

Would someone be able to provide some sample code on how to do this? I need to check if the bar is complete and if it is then place the order.

This is greatly appreciated.

Its very simple. Just do something like:

if (iBars>Bars){

Code to execute when new bar arrives;

Bars=iBars;

}

 
InTrance:
Its very simple. Just do something like:

if (iBars>Bars){

Code to execute when new bar arrives;

Bars=iBars;

}

InTrance

As you well know, Both 'Bars' and 'iBars' are key words in MT (iBars() being a builtin function), and should not be used in the fastion indicated, it will cause an error as you can not set the key word 'Bars' to another value. and the use of iBars as a veriable name would be confusing, as well. I understand were your coming from but someone not well versed in the MQ language will be misleaded with your choice of varible naming here, especially if they carry them over in their code.

Keit

Reason: