You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Please explain what kind of martingale strategy are you trying to make ???
Your code is full of strange coding.... that i get problems to understand what you try to do
you don't tell how your trailing is coded now
and now we get an opposite strategy where you in the loop of your orderstotal open new trades and refresh fresh fresh rates
this is the begin if the ea restarts what has there to happen ???
Do you look in the closed trades for last closed trade if it is buy or sell if buy you want open sell
if last closed sell you want to open new buy trade ??
Question(s)
don't you have to know if there is still trades running ??
and what has to happen if there is no history of the EA in historytrades
So what did you wanna make the moment you started to code this ??
Hi deVries,
You alert me for the fact that I do not need to get information about last type of order closed.
The strategy is:
Start: there is no open orders
If price goes up then a Buy order is open, then if price don't reach the MinimumProfit and bounce back the amount of OppositeDistance a Sell order will open with a lot increase given by multiplier. Here if the Sell order do not reach the MinimumProfit and bounce back the amount of OppositeDistance a second Buy order will open and so on.
The same if price goes down.
Once price equals the amount given by MinimumProfit then Trail will start, if price bounce back all open orders will close.
Hope that gives you the clarification you need to help me.
The problem with the fail of Trailing stop is ok after I've change the direction of count the orders. Before I had the orders counting down and now is counting up and trail do not fail now.
Take your advise about getting the state of ea at start I thing that the way to go is to first identify which orders in the pool are from the ea (if any) and if are == 0 then the ea can open orders. Here my doubt is if we have more than one order open how can figure out that this orders are ok and the ea can keep to opening orders ?
Thank you again
Luis
Hi deVries,
You alert me for the fact that I do not need to get information about last type of order closed.
The strategy is:
Start: there is no open orders
//Then if the EA has to restart check openorders of the EA first if this is true
if not true the EA has to find out what trade it has open....
If price goes up then a Buy order is open, then if price don't reach the MinimumProfit and bounce back the amount of OppositeDistance a Sell order will open with a lot increase given by multiplier. Here if the Sell order do not reach the MinimumProfit and bounce back the amount of OppositeDistance a second Buy order will open and so on.
// No open trade set buystop and sellstop order with xx pips distance from price that moment and one of them will hit certainly moment
if buy or sell open delete old remaining stoptrade
place opposite stoptrade from open trade xxx pips from orderopenprice first trade with new lotsize
if this stoptrade hits you can close first trade and place new stoptrade where first started with your new multiplier lotsize
Remember total losses if you get in profit don't close directly maybe with moving orderopenprice open stoptrade you can trail first moment
if this moves over orderopenprice open trade you have i think the profit for sure to close open buy or sell that part you have first lotsize
if profit big enough close both trades
The same if price goes down.
Once price equals the amount given by MinimumProfit then Trail will start, if price bounce back all open orders will close.
Hope that gives you the clarification you need to help me.
The problem with the fail of Trailing stop is ok after I've change the direction of count the orders. Before I had the orders counting down and now is counting up and trail do not fail now.
Take your advise about getting the state of ea at start I thing that the way to go is to first identify which orders in the pool are from the ea (if any) and if are == 0 then the ea can open orders. Here my doubt is if we have more than one order open how can figure out that this orders are ok and the ea can keep to opening orders ?
Thank you again
Luis
It is a dangerously strategy and it can blow up your account in a bad period where price bounce alot with support and resistance area
Hi deVries,
Thank you for your comments which are of up most importance for me. Nevertheless and with the objective to show only those orders that have to get processed by the ea I've write these lines of code. Here I've a problem; When use Orders, which from what I understand should be only the orders sorted from orderstotal() that are present in the pool the ea keeps open orders. When I substitute that by orderstotal() the ea works fine. So of course that I'm sort out the orders from the pool in a wrong way. Is possible some help here ?
Luis
finish this for all OrderTypes
finish this for all OrderTypes
Good Morning deVries,
So, I believe have done what you ask me to do. Here is de code:
Is anything wrong or missing ?
Thanks is advance for your support and patience.
Luis
Is anything wrong or missing ?
Thanks is advance for your support and patience.
Read the code you have added . . . .
Why are you setting BuyLots for a SELL STOP ?
Read the code you have added . . . .
Why are you setting BuyLots for a SELL STOP ?
Hi RaptorUK,
Right !
On Fridays seems that I'm a complete idiot (just not to mention the other days...)
Is updated now.
Thanks
Luis
Thank you Simon for the help
to Luis and all who read this goodday to you ( don't know what timezone you live in )
Edit your post for updated code till now we can't see you have done it
Look also to the code i gave to you a few attention might helpHi deVries,
Which code do you refer, the one you ask to me to complete or your code inside the code that I've to moment ?
Hi deVries,
Which code do you refer, the one you ask to me to complete or your code inside the code that I've to moment ?
De code you gave yourself edit that message you can't edit other persons messages
luisneves 2013.03.01 12:06
De code you gave yourself edit that message you can't edit other persons messages
luisneves 2013.03.01 12:06
Hi deVries,
In attach is the code, but something is wrong (...)
I've put out from the code Get History and get a new CloseOnSL () function to identify the last order closed by the ea and the proceed to call CloseAll () function.
Luis
Update issue;
I get several errors and seem that some variables are not defined. While those variables are defined as global shouldn't be recognized ?