Basic questions ... - page 10

 
Pava:
I had a tread on this forum that had a magik number solution...unfortunately davidke & walander hated my innovative ideas & raised stink all over the board...consequently my tread was deleted...

That's the road this is taking me down. I am thinking that I can have the EA write the magic number to a file and then if the magic number exist it will not reopen the trade.

FileWrite - MQL4 Documentation

 

Only 1 Trade

Hello,

i'm searching for a MQL - Code.

I want open one trade and if the trade is closed by TP or SL then start the next trade.

Only one trade should be active!

Can anyone help me?

Kind Regards

Daniel

 

Need some help!

I want to implement the following:

Open 2 orders maximum per every M15 frame. I cannot find out how. Would someone write some code or give an appropriate link?

Thank you very much

 

In MT4, when you create EA, there is start() function which is called on each price tick. Inside that function you can track opening time of current candle by reading value of Time[ 0 ]. If this value changes from previous reading, you are on first tick of new candle, so you should open your trades in that moment.

 

Thank you for the answer.

However, by placing at the beginning of the M15 frame two pending orders, how may I prevent the robot from opening more than 2 orders during this interval? Moreover, in the next M15 frame I want the same: again placing two pending orders and if these will be opened do nothing else till the end of the current M15 candle.

Thank you

 

OrderSelect

Hi All,

I have a question about Orderselect. I want to find the time the last order was closed. is there any way to know how many trades are in the MODE_HISTORY index and select the last one?? or doI have to select each order in turn and check for MAX OrderCloseTime()??

Thanks

 
Lurch:
...is there any way to know how many trades are in the MODE_HISTORY index and select the last one??

No, this is not reliable because it depends of how the history table of the terminal is sorted.

Lurch:
Hi All, ...or doI have to select each order in turn and check for MAX OrderCloseTime()??

Yes, this is the right way.

 

Close All Orders Trailing Stop

Hi all,

New to coding, but I am taking a C course and understand the concepts pretty well. The MQL4 is a bit more complicated.

Anyway, I figured out how to close all orders, and I figured out how to create a trailing stop, but what I can't figure out is how to have a trailing stop that closes all open order.

For example,

Lets say I have .1 lots buy at 1.000, and another .1 lots buy at 1.040. The trailing stop is 15, so lets say the price goes up to 1.050 and then comes down to 1.035. At 1.035, I want both positions to close. The way it is working now is that only the last position opened closes when the TS is hit.

 

limit number of open orders

Is it possible to limit the number of orders open at any one time in metatrader, for example i have an ea running on differant charts and do not want any more than 10 open orders at once ,is there a way to do this?

thanks for any help.

 

Deleting Indicator Header

Is there anything I can do to delete the header of an indicator. The indicator has 8 buffers and it shows all the variables in the header which I do not want to visibly see on the graph. There is no string code in the indicator to '//' so it seems by default to list all the indicator values automatically. Is there any solution to this??

David

Reason: