Something missing and i don't know what
-
I'm working in a new simple EA but it doesn't work as I wish. This is why I ask for some help ;). Here's the project:
https://fxdreema.com/shared/GFDBuTBye
And this is what it is suposed to do:
-
A buy and a sell are launched at current market conditions (tome frame 1 minute).
First problem here: I don't know why but any of them are opened at current market price, but a few pips abaove/below ask/bid. -
After two minutes (two bars) has passed from open price, the stop loss can me modified according to the condition included in the "check stop loss" block .
-
Once condition is met (moving average value at that bar plus/minus 5 pips), the stop loss should be moved up to that price:
Second problem: stp loss is not moved at all.
Any help would be appreciated.

-
-
Second problem solved. I simply disconnected buy/sell blocks from the rest of the blocks. Now I understand how it works. Sadly, problem 1 is still active.

-
Buy - is opened at Ask price,,, and is this Buy is closed at Bid price
Sell - is opened at Bid price,,, and this Sell is closed at Ask priceand example, if Buy is opened higher than offered Ask price - this is question for your broker

-
Ok. This is what I got so far:
https://fxdreema.com/shared/Zkk80AJ6e
Now I have a second problem again. My now moving SL goes up and down! How can I hold it shrinking in one direction only (upwards in a buy and downwards in a sell)?

Sorry for this permanent updating of the thread but I'm learning on the go!

-
__Buy - is opened at Ask price,,, and is this Buy is closed at Bid price
Sell - is opened at Bid price,,, and this Sell is closed at Ask priceand example, if Buy is opened higher than offered Ask price - this is question for your broker :D[/quote:25e6vnds]
You're right. My broker is cheating me!

Now I need a bit of help in my new second problem.

-
one of solutions can be comparing if the new SL (for buy) will be higher than current one, you can done it with variables
but dont forget distinguish between pips and price, you can easy make mistake, ex. if you compare pips with price 
variables:
lastBuySL
lastSellSL
newBuySL
newSellSLCondition block for Buy: if newBuySL>lastBuySL --- set new SL (after this store new SL into lastBuySL)
Condition block for Sell: if newSellSL<lastSellSL --- set new SL (after this store new SL into lastSellSL)

-
Great! It worked very well.
Now an additional difficulty is added and I know I'm close, but not enough. This is my project now (only buy section included):https://fxdreema.com/shared/okGed5M9b
This is what the EA has to do:
- A buy is opened with a specific TP and SL.
- Two candles after opening (1 minute time frame) the SL can be moved, not before.
- The SL moves at a fixed distance (5 pips) below the 10 periods moving average.
- The trade finishes once TP or SL are reached.
It works perfectly so far except for one single point. Sometimes the moving average is so close to the SL that when adding those 5 pips, the new SL is moved below the original position, and I don't know how it not to happen. I see that in my first "Modify Order" block there an option to chose "pips" instead of "proce level" at the "Mode" option. Could this be the solution?
Thank you very much in advance.
-
you can try add new condition for measuring distance this MA from SL price, lets say logic:
measuring_distance > my_value (if true - next block can pass)
where measuring_distance you can get as difference between MA price and SL price (dont forget, here can be negative result)
and my_value is compared value, maybe you can set it with conditions like pips or normal price fraction (0.0010 ...)

-
Done. Thank you for your suggestion
