Dukascopy
 
 
Wiki JStore Search Login

Calculating current height of the candle
 Post subject: Calculating current height of the candle Post rating: 0   New post Posted: Wed 06 Jul, 2016, 00:21 
User avatar

User rating: 0
Joined: Fri 01 Jul, 2016, 16:52
Posts: 4
Location: PortugalPortugal
Hello, I'm trying to calculate current height of the candle.
If candle is bigger then 10 pips trade is opened. I'm using calculation block:
(lastTick.TickBid - LastBidCandle.CandleOpen)*10,

but I cannot get it right, could someone help me please, what I'm doing wrong

It seems that the problem is in LastBidCandle.CandleOpen variable, it is supposed to return open price of the current candle, but it doesn't.


Attachments:
test.vfs [13.99 KiB]
Downloaded 95 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.
 
The Best Answer  Post subject: Re: Calculating current height of the candle Post rating: 0   New post Posted: Wed 06 Jul, 2016, 18:35 
Visual JForex expert at Dukascopy
User avatar

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

When using last candle, the system is actually working with the current candle and not really the last one: so the current candle which still fluctuating has obviously no final value for high, low and close prices till it reaches the expiry time (of the relevant period).
In order to do what you need, you should work with "Get historical candle" with shift 1 and use the related prices out of the block's output.

Cheers


 
 Post subject: Re: Calculating current height of the candle Post rating: 0   New post Posted: Fri 22 Jul, 2016, 17:29 
User avatar

User rating: 0
Joined: Fri 01 Jul, 2016, 16:52
Posts: 4
Location: PortugalPortugal
Hi,

Thank you a lot for your reply, - everything works great.

I was trying to apply a custom trailing stop which would work at 1 pip step on every tick, but just adding a standard block doesn't seem to work, could you please guide me with this as well ?

Many thanks in advance !!

Cheers


Attachments:
test.vfs [35.19 KiB]
Downloaded 117 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: Calculating current height of the candle Post rating: 0   New post Posted: Mon 25 Jul, 2016, 11:29 
Visual JForex expert at Dukascopy
User avatar

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

I've made slight changes to your strategy to make the trailing step working: The trailing stop block should not be "blocked" by conditions that can stop its execution because the trailing step is managed 100% by the strategy and not by our servers or Jforex platform therefore, if you insert a condition checking for the number of open position before executing the trailing, then the stop wont be executed.

Besides, you have to check your entry conditions as the strategy doesn't seems to open trades at all.

Cheers


Attachments:
test_V2.vfs [40.74 KiB]
Downloaded 111 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: Calculating current height of the candle Post rating: 0   New post Posted: Mon 25 Jul, 2016, 21:29 
User avatar

User rating: 0
Joined: Fri 01 Jul, 2016, 16:52
Posts: 4
Location: PortugalPortugal
Hello,

Thank you for your response, actually the strategy has stopped working, let me try to explain why.
I have 3 blocks with calculations in it with output values:
RangeFilter - always gives fixed value of 10 pips;
RangeFilter1 - always gives fixed value of -10 pips;
CurrentHeight - gives height of the current candle, using close of previous candle - current price.
As soon as CurrentHeight is > than RangeFilter we have a sell (every bull candle which is bigger than 10 pips), and vice versa.
I have noticed that you have placed CurrentHeight expression "on candle", instead of "on tick", I have placed it back "on tick" (we need to have calculations on every tick, not on close of the candle), but for some reason on backtesting the strategy now only makes 2-3 trades on first trigger candle (>10pips) and stops as if backtesting is finished, have no idea why.
Also, do you think it would be possible to make a trailing stop reacting to the price on every tick, not only at candle close ?

I hope it makes sense :)

Many thanks in advance, I really appreciate your help !!


Attachments:
test_V3.vfs [40.74 KiB]
Downloaded 102 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: Calculating current height of the candle Post rating: 0   New post Posted: Tue 26 Jul, 2016, 11:04 
Visual JForex expert at Dukascopy
User avatar

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

here you go: I've adjusted the blocks as per your remarks. there was a little issue related to trailing step but I found a workaround using the assign block to bypass the error.
please test and let me know


Attachments:
test_V4.vfs [41.41 KiB]
Downloaded 124 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: Calculating current height of the candle Post rating: 0   New post Posted: Tue 26 Jul, 2016, 23:59 
User avatar

User rating: 0
Joined: Fri 01 Jul, 2016, 16:52
Posts: 4
Location: PortugalPortugal
Hi Amine,

Trailing stop works great, thanks a lot for your help!!

I'm thinking now to implement logic of this strategy on tick charts, in order to try to catch fast moves, could you please advise me what would be the best way to calculate the difference between current tick and 1 tick before. Also default trailing stop is using integer variable, is there a simple way to use double variable in order to be able to set 0,5 pips for example (by default it is not allowed)?

Thank you!

Regards!


 
 Post subject: Re: Calculating current height of the candle Post rating: 0   New post Posted: Thu 28 Jul, 2016, 12:01 
Visual JForex expert at Dukascopy
User avatar

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

Check the attached example, it should inspire you.
As for the trailing step, it is indeed to be used with integer so the minimum is 1 pip. if you need less, then the overall trailing stop logic should be programmed manually.
I'll let you come up with an example and I'll help you

Cheers


Attachments:
Tick_check.vfs [20.57 KiB]
Downloaded 115 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.
 

Jump to:  

cron
  © 1998-2024 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