Dukascopy
 
 
Wiki JStore Search Login

Find stoploss level
 Post subject: Find stoploss level Post rating: 0   New post Posted: Fri 13 Jun, 2014, 07:36 
User avatar

User rating: 0
Joined: Tue 27 May, 2014, 05:52
Posts: 5
Location: MalaysiaMalaysia
Hi

Apologies for my very easy .VFS. I am brand new to this and have been running in circles for days and not going forward. I have stripped the VFS file of everything that does not work. It works as it is but I want it to do more. I have two problems. The first is setting the initial stoploss when the last candle is either an inside or outside candle. After days with Oncandle I realise I may have to change to Ontick start point. The reason is initial stoploss will change before the candle is finished if it is an outside candle. I assumed it broke lower before reversing and triggering pending buy stop. I am a loss to know how to do this.

The second problem is I only want one pending order (the latest one). At the moment the other pending orders close when Trade event has a position. The trouble with this is I could get two orders entered if pending orders bunched near each other. I have tried using the last bid price and goodTilTime but having no joy
Image

I would really appreciate some pointers to guide me on the way

Thanks


Attachments:
FindStoploss.vfs [42.69 KiB]
Downloaded 141 times
stoploss calc.png [16.44 KiB]
Downloaded 423 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Find stoploss level Post rating: 0   New post Posted: Sun 15 Jun, 2014, 10:57 
User avatar

User rating: 0
Joined: Tue 27 May, 2014, 05:52
Posts: 5
Location: MalaysiaMalaysia
Giving up, admitting defeat, and asking for your help was a good move. Letting go has let me move a bit closer this weekend.

This is exactly like learning a foreign language. I didnt want to post my VJF because know it is not right and worried about everyone pointing and laughing at me. No time to be shy. This is still not right but more content than the last file I posted. I still cannot anchor the stoploss under the lowest low. It seems to jump up when a new candle starts. Sometimes I get multiple SL and TP lines on the chart as well. Not sure if they are "real" or not.


Attachments:
FindStoplossv2.vfs [53.77 KiB]
Downloaded 143 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Find stoploss level Post rating: 0   New post Posted: Mon 16 Jun, 2014, 15:37 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Greetings,

we'll be happy to help you if you provide us with accurate explanation about the following:
- What are the conditions to enter a buy stop exactly ? Do you want to reproduce the exact shape that you sent us in your previous screenshot ?
- please explain your use of "Inside candle" term ??
- How many pending position do you want to open ?
- Conditions to send a buy stop: How many candles do you want to check ? 2 previous candles are sufficient ? please explain what will be checked as well.
- What are the exit conditions ? will you keep you pending positions till execution and then SL or you want to implement a cancellation process?? if yes, when and following which conditions

- Your description in the previous screenshot is quite ambiguous, can you please take a hourly chart of Jforex platform on EUR/USD and show us again your entry conditions ?

Thanks in advance for the information.


 
 Post subject: Re: Find stoploss level Post rating: 0   New post Posted: Tue 17 Jun, 2014, 16:10 
User avatar

User rating: 0
Joined: Tue 27 May, 2014, 05:52
Posts: 5
Location: MalaysiaMalaysia
Hi Amine

Thank you for having a look at my strategy. I do apologise for my original poor description. I did not realise how confusing it was until I read it again. It is more difficult than I thought. Your questions have made me realise some of my logic was wrong and also made me consider other factors. I will try and do a better job this time but please ask again if I am still unclear.

I want to run this strategy on the 60 minutes EUR/USD.

It is discretionary when I run the strategy. I will use it for trade entry and management when I wish to place a pending buy stop . If I decide to trade, the strategy should place a pending buy stop at high of the last complete candle and an initial associated stop-loss at the low of last complete candle The lot size/risk will be percent of equity and based on pips difference between buy stop and stop-loss.

If during the current period, the buy stop is not touched (no orders) ,and the current price goes below the initial stop loss level (ie if the candle goes lower than the previous candle) then the stop-loss and lot size should recalculated so that the stoploss is always at the lowest possible level.

(This is done in real time..not waiting for current candle to finish)

If the buy stop is not touched (no orders) then the pending order should be closed just before a new candle is formed. The pending buy stop is then recalculated and placed on this newly formed candle. There is ever only one pending buy stop. It keeps looking to buy and with the lowest initial stop-level.

If during the current period the buy stop is touched (market order) then the initial stop-loss should not be moved. No other trades should be entered.

The one exception to the rules above is when we have an inside candle. It will have a lower high and a higher low than the previous candle. Its complete range will be inside the previous candles range. In this case the buy stop will still be moved to the high of inside candle but the associated stop-loss should be left at the previous candle. ( The previous candle has a lower low than the inside candle so a safer stop-loss level..it is probably a fractal?)

This would also be the case if we have multiple inside candles within each other. We would keep the stop-loss at the original candle that had the lowest low (the candle whose range the inside candles are within) If buy stop not entered (no orders) and price goes below stop-loss level then recalculate stop-loss level. If buy stop not entered (no orders) and next candle not an inside period treat as normal. (IE buy stop at high and initial stop-loss at low)

The strategy would keep working until a buy stop is touched ( market order). If we are in the market no further trades are placed. Once our position is flat due to initial stop-loss or raised stop-loss a new pending order can be placed..(note this would only be the case when historically testing...if used in live trade the strategy would stop until needed again)

In regards to orders they should be placed as two buy stop orders at the same price so that two different stop-loss strategies could be used.( Effectively split order in two so can use different SL for each). The first would be simple trailing stop under the subsequent finished candle lows. The second could be to move stop-loss to successive fractal lows ( a low with a candle either side that has a higher low).

I hope this seems more sensible than my first attempt and has answered your questions. Thanks again.
Image


Attachments:
find stoploss.png [56.68 KiB]
Downloaded 452 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Find stoploss level Post rating: 0   New post Posted: Thu 19 Jun, 2014, 10:33 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Hi there,

Thanks a lot for the detailed explanation, that's definitely helps but there is some contradictions on the following statement:
From your previous post:
" If during the current period, the buy stop is not touched (no orders) ,and the current price goes below the initial stop loss level (ie if the candle goes lower than the previous candle) then the stop-loss and lot size should recalculated so that the stoploss is always at the lowest possible level."

This is in total contradiction with:

" If the buy stop is not touched (no orders) then the pending order should be closed just before a new candle is formed. The pending buy stop is then recalculated and placed on this newly formed candle. There is ever only one pending buy stop. It keeps looking to buy and with the lowest initial stop-level."

So the question is: When the stop should be moved ? to be moved it has to check for the next candle low if it is lower then the previous but at the meantime you're saying if we move to the next candle the pending should be cancelled and resent in the next one ... this is a bit confusing.

In any case, to let you move forward, I'm sending your strategy as per the following spec:
- STOP BUY to be placed on the High / SL on the low of the last formed candle
- If the next low price is less then the current, the SL will be moved to this new low.
- If a STOP BUY is filled, the SL is kept at the same position
- The strategy trades a single pending order at once/ single open position at once.
- If your description of "Inside candle" is detected, a STOP BUY order will be placed on the current candle High and the SL on the previous candle Low.

Kindly feel free to adjust, modify and test this strategy in order to cope with your specification.

Thanks


Attachments:
Gent.vfs [42.62 KiB]
Downloaded 169 times
DISCLAIMER: Dukascopy Bank SA's waiver of responsability - Documents, data or information available on this webpage may be posted by third parties without Dukascopy Bank SA being obliged to make any control on their content. Anyone accessing this webpage and downloading or otherwise making use of any document, data or information found on this webpage shall do it on his/her own risks without any recourse against Dukascopy Bank SA in relation thereto or for any consequences arising to him/her or any third party from the use and/or reliance on any document, data or information found on this webpage.
 
 Post subject: Re: Find stoploss level Post rating: 0   New post Posted: Thu 19 Jun, 2014, 13:53 
User avatar

User rating: 0
Joined: Tue 27 May, 2014, 05:52
Posts: 5
Location: MalaysiaMalaysia
Hi Amine

Sorry if I was confusing. I would really like to make it clear and I think I know where the problem is.

The pending orders are placed on a new candle. A buy stop at high with initial stoploss at low of this candle. That is the easy bit. The candle is formed and static.

Unless there is a gap, the next opening price will be between our buy stop and initial stoploss. I may be mistaken because I have been calling this the current candle. This is where I have been confusing. It is not a candle yet because it has not finished. I will now call it an unfinished candle for want of a better name. It is not a candle until 60 minutes time when it closes. All we know about the unfinished candle is the opening price and when it will finish.

If after say 30 minutes the unfinished candle, does not touch our pending buy order, but does move below our pending stoploss level then we have a chance to move that stoploss level downwards. We have to do this constantly (in realtime, not waiting for candle to finish) with an unfinished candle as it moves down. This is because we want the stoploss at lowest price level.(we lose that ability if buy stop touched)

If the buy stop is not touched and the unfinished candle is almost due to complete we should have a buy stop on the previous candle high and a stoploss on the low of this unfinished candle. The instant the candle finishes the buy stop is moved to this newly finished candle with a stoploss at the low of the newly finished candle.

In the situation where we have adjusted the stoploss level down on an unfinished candle when it becomes finished the stoploss will be the same level. The only thing that will change is the buy stop level on the now completed candle.

In response to your question we cannot use a check for a candle low, lower than previous candle because this relates to finished candles. We want to find the low while the candle is forming.

Saying it another way. We place a buy stop on an hourly candle high with a adjustable stoploss on the low. If the price continues down we alter the stoploss so that is always at the lowest price. This order is cancelled when a new candle appears. We then place another buy stop on the new candle high and another adjustable stoploss at its low.

I hope that makes more sense. Let me know if it needs more work. Thanks for so much for your help.


 
 Post subject: Re: Find stoploss level Post rating: 0   New post Posted: Thu 19 Jun, 2014, 16:13 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Alright,

There is another detail added in your last post: constant move of the SL which means working on the Tick prices instead of candles once a pending order has the state |OPENED]
You need then to reconsider this need as this makes the strategy heavier cause I'm not sure that the fact of checking every single tick < the previous and moving the SL accordignly has a significant impact from your description. I believe that you can stick with 1 mn check in terms of lowest price with regards to your trading period.

Finally, feel free to implement these changes and test and raise any question if needed

Thx !


 

Jump to:  

cron
  © 1998-2025 Dukascopy® Bank SA
On-line Currency forex trading with Swiss Forex Broker - ECN Forex Brokerage,
Managed Forex Accounts, introducing forex brokers, Currency Forex Data Feed and News
Currency Forex Trading Platform provided on-line by Dukascopy.com