|
|||||||
| Register in Forex TSD! | |
|
Trading Systems Leaders in this forum (automated trading systems) are winning more than 3000 pips in a month (30000$ investing one lot every time). Click here to register and get more information |
|
|
|
LinkBack | Thread Tools |
|
|
|||
|
|||
|
Quote:
PHP Code:
|
|
|
||||
|
||||
|
Quote:
'OrderTotal' - variable not defined C:\Documents and Settings\!.mq4 (61, 18) also can I add an 'extern double Percent = 0.3;' line then change the trade code to look like; Code:
if(SMA*(1+Percent/100))>Ask && ((dir==1 && Ask<=LastPrice-PipStep*Point)||total<1)) // Go LONG -> Only buy if >= 30 pips below previous position entry Code:
if(SMA*0.98>Ask && ((dir==1 && Ask<=LastPrice-PipStep*Point)||total<1)) // Go LONG -> Only buy if >= 30 pips below previous position entry ![]() also, is the StopLoss setting for all open orders added together or for each individual order? If EA is set to close all orders when total SL is hit, can you change it so that SL is for each separate order. Thanks again Last edited by matrixebiz : 09-15-2007 at 12:55 AM. |
|
|
|||
|
|||
|
Quote:
I made two modifications : 1) the EA use now only the positions of the pair on which he is attached. 2) the EA keep the direction of the first position (of that pair). This is needed is some TP / SL / entry configuration where the EA may open buys and sells simultaneously; then the average price, new TP and SL have no meanings anymore. It is possible to write an EA working in both direction at the same time but it's much more complex. The simplest way to do that is to work with two EAs with different MagicNumbers and only long / only short. If you need it, tell me if you want any help. The other modifs are only the right way to achieve the same goal. For example, one cannot assume that the last order is indexed by OrderTotal(): first it should be OrderTotal()-1, but this may also be wrong because it depends of the sorted collumn of the "trade" tab of the terminal or if you have opened positions on other pairs. I tryed to keep most of your code, and I keep also most of it's lack, for example, don't play with manual pendings on the same pair: all will be wrong... It will be possible to improve the security if you find that this basic EA is profitable. "also, is the StopLoss setting for all open orders added together or for each individual order? If EA is set to close all orders when total SL is hit, can you change it so that SL is for each separate order." Now the SL is based on the average price (as I understood your code). If you do not want to have a general SL, just don't modify them. Then the "modify" line should only modify the TP : PHP Code:
Last edited by Michel : 09-16-2007 at 09:13 PM. |
|
|
||||
|
||||
|
Quote:
so are you also saying that the EA cannot place a buy and sell with the same currency at the same time untill one of them is closed? can that be fixed? also, how do you add a little bullet (graphic) on the chart that shows when the order was placed? Thanks |
|
|
|||
|
|||
|
Quote:
if you want a general SL, ie the same level for all positions so they are all closing at the same time, use this line (This was the way your original code was intended to work): PHP Code:
PHP Code:
About to buy and sell at the same time, you must understand that the average price, the SL and TP as they were defined in your code have no meaning if the directions are mixed. Just look at this example: situation 1: you have a buy at 1.200 and a sell at 1.220; situation 2: a buy at 1.200 and a buy at 1.220; Your original code makes no distinction between both situations, but they are really different... That's why I suggest you to add a MagicNumber to the EA and to work on one chart with the EA to open only the buys and on an other chart with the same EA but with another MagicNumber to open only the sells. |
|
|
||||
|
||||
|
Quote:
If you have time can you fix it so that it will recompute when I change the SL code as you mentioned plus work with multiple direction trades without using a magic number. Thanks alot Last edited by matrixebiz : 09-17-2007 at 12:51 AM. |