Is it possible to close a trade/trades after a certain period of time after entry'? Irrespective of the trade being profit or loss?
I'm on my iPad not laptop so can't try blocks to see what works. So sorry if it's actually obvious.
Is it possible to close a trade/trades after a certain period of time after entry'? Irrespective of the trade being profit or loss?
I'm on my iPad not laptop so can't try blocks to see what works. So sorry if it's actually obvious.
@miro1360 Thanks for your reply. I didn't word it very well. I meant if i have a number of trades and the total loss of those trades reaches a certain amount then i want to close all trades. Similar to having the combined profit of a group of trades reach a certain profit level and closing all trades.
So not using it as a stop loss level but using it as a stop loss $ amount.
It looks like I can use the check profits (unrealized) then. I will go and test it out.
@miro1360 is there a similar block to use as a stop loss? Can I use this block with a negative value? If so can I use one for profit and another one for stop loss?
I can see that would work if you had a fixed pips stop loss. But as this uses a stop based on the prior bars range it changes every trade. Looks like I'll have to use the one I developed.
Thanks for showing me that option though. It might be handy with other strategies.
Like this? https://fxdreema.com/shared/JAibZKYU
Is there anything you would do to simplify?
Thanks again for your help. I still haven't figured out the labels but will keep playing with it to get it to work.
I thought that using custom (level) I was setting the initial level of the trailing stop and that it would then rise as price rises based on the trailing step being used. Similar to setting the pips value using custom (price fraction). Obviously this isn't the case.
I'll use the custom (price fraction) from now on.
Unfortunately I haven't figured out how to add the labels like you have to show the changes in the stop loss but hopefully the printscreen below will show what I mean.
When I use this EA using custom(price fraction) the stop loss moves up with price.
https://fxdreema.com/shared/yAIiKAhac
As can be seen here the stop loss moves up with price.
http://prntscr.com/cosxi1
However when I use this EA using custom(level) the stop loss doesn't move with price.
https://fxdreema.com/shared/agTw2oRMd
As can be seen here.
http://prntscr.com/cosz3a
In neither of these EA's is a stop loss set. Only a trailing stop.
I have set up a very basis buy strategy with a trailing stop loss to see if I could get it to work as I think it should.
When I use a custom (level) the trailing stop is initiated but doesn't trail as price rises. https://fxdreema.com/shared/tv1d2Fcgc
When I use custom custom (price fraction) the trailing stop is initiated and does trail as price rises.
https://fxdreema.com/shared/Ww3EPLoPb
I must be doing something wrong?
I still can't get the trailing stop to run when using calculated variable. When changing to say an 80 pip stop loss the trailing stop works.
Any suggestions?
Hi gustavorosso
I'm only new at this but I think you would use a condition block before your buy now block as per this https://fxdreema.com/shared/pLOy2MIre
Thanks. That makes sense. There must be an error in my variable then. Is there a way to see the value of the variables? Does it matter if the variable is number of pips or an actual price? I assume as long as I specify within the block that I am setting the trailing stop based on pips or level that corresponds with the variable it should be ok?
By initial trailing stop I mean say I enter a long trade at 1.2250 with a stop loss set at 1.2200 and a trailing stop at 1.2150 then my initial trailing stop is 1.2150 and it is from this level that the stop trails behind price as price moves in my favour.
Is it possible to use a Variable as the initial trailing stop loss level?
I have used "Custom(level)", "Value", "Numeric" and inserted a Variable calculated in a Formula block as my initial trailing stop loss level. The block accepts it but when I run a test the trailing stop doesn't move. When I change it to Trailing stop is "Pips" and put in a value of say 80 the trailing stop moves as price moves.
Anyone have any suggestions? I have modified my original query as I have sorted out my placing the original stop loss issue.
Is it possible to place multiple trailing stops?
I trail my stop differently depending on how many pips a trade is in profit. What I would like to do is have 2 trailing stops as follows (example is for a buy trade):
A stop that moves up 1 pip for every 2 pips that the trade goes in profit. i.e. if my R was 70 pips and my trade is 40 pips in profit the stop would have moved up 20 pips. So my potential risk from the high is now 90 pips but from the entry point it is now 50 pips. This allows my trades that move in my favour to expand the amount of room that I give them but still moves the stop loss up so that my overall risk on the trade reduces. This is only done until my trade is 2R in profit. i.e. at this point my stop loss would have moved up 1R or in other words be at break even.
Once a trade is up 2R the stop moves up 1 pip for every further pip thye trade moves in profit. i.e. the stop will now be 2R from the highest price the trade has achieved.
If possible how do I code it?
Ok I think the error is in my trailing stop not the original stop loss.
My trailing stop is meant to be:
opening price - stop loss x 2
For example:
0.89678 - 0.89117 x 2 = 0.01122
The trailing stop is trying to place a stop at 0.01122 pips from the opening price. How do I convert this into pips? I could multiply by 10,000 and get 112.2 pips but this wouldn't work for JPY pairs?
Is it possible to place multiple trailing stops?
As mentioned in another post I am having issues with getting my original stop loss to work. I also trail my stop differently depending on how many pips a trade is in profit. So what I would like to do is have 3 trailing stops as follows (example is for a buy trade):
If possible how do I code it?
I understand that it's more likely to be an error in my code than a bug in the block. I don't understand what I need to do to code it correctly. As mentioned originally when I run a test the buy stop, stop loss and take profit are correct. It is when the order actually opens that the stop loss value changes. Are you able to have a look at my Project "RSI(2)v1.0"?
Thanks miro1360. That is awesome. Makes perfect sense.
How do I save the EA that I'm working on into a new version? I want to be able to make small changes to an EA that I have built and save them as a new version instead of having to delete the changes if I want to us the original one?
I have tried copying all of the blocks, loading a new project then pasting the copied blocks. This copies some blocks more than once and just adds them to the page without being linked to any other blocks. It also doesn't copy across the Variables where I have put calculations from Formula blocks.
Thanks. Not sure what I'm meant to do with this though?
Is there a different way I should be placing a buy stop order? i.e. I know at what price I want to buy based on calculations using the condition and formula blocks. The price is currently below this price. How do I place an order to buy above the current price and have my stop loss value applied?
Does it make any difference that the stop loss is a variable that has been calculated from within a Formula block? If so how do I get around this? I have a formula that subtracts from the low of the previous bar a percentage of the ATR. This result is put into a Variable, say "Part3". I then use a Custom (price level) as my stop loss and use the Variable "Part3". Is there another way to do this?
When I run a test my initial Buy Stop shows the correct buy stop (0.98256), stop loss (0.97560) and take profit (1.00959) price but when the trade actually opens it says that the stop loss requested is too short (it is using the buy stop opening price (0.98256) as the stop loss not the originally calculated stop loss) and it will use a minimum stop loss that appears to be equal to the spread. This means I am stopped at at the time of opening the trade.
I tried to attach a screenshot from the journal in strategy tester (but get an error) that shows the first line (bottom line) with a stop loss of 0.97560. The calculation for this works correctly. The 2 lines above that it says "Warning: Too short SL requested (0.98256 or 0 points), minimum will be taken (0.98230 or 26 points)".
How do I fix this please?