|
Candle counter |
mad_max
|
Post subject: Candle counter |
Post rating: 0
|
Posted: Sun 27 Jul, 2014, 12:10
|
|
User rating: 0
Joined: Mon 07 May, 2012, 07:24 Posts: 69 Location: CroatiaCroatia
|
Hello!
I need solution how to count number of candles starting when position is open and reset it when position is closed.
Is it possible and how?
Regards
|
|
|
|
|
amine_chourou
|
|
Post subject: Re: Candle counter |
Post rating: 0
|
Posted: Mon 28 Jul, 2014, 08:17
|
|
Visual JForex expert at Dukascopy | |
User rating: 288
Joined: Thu 18 Apr, 2013, 09:26 Posts: 1496 Location: Switzerland, Geneva
|
Greetings,
Yes indeed: Assuming that your strategy is subscribed to a given period, once a position is opened, your set a trigger (any variable that takes a given value, the best is to use a True/False Boolean variable) and then IF this var is TRUE, you set your counter (simple calculation block that performs an incrementation by 1). Afterwords, once the position is closed, your trigger has to take the value FALSE and therefore you set your counter to 0.
|
|
|
|
|
mad_max
|
Post subject: Re: Candle counter |
Post rating: 0
|
Posted: Mon 28 Jul, 2014, 18:31
|
|
User rating: 0
Joined: Mon 07 May, 2012, 07:24 Posts: 69 Location: CroatiaCroatia
|
Hello and thanx for quick reply.
I know everything what you meant except what variable in calculation block would increase (count) number of candles. F.E.: Time frame is 4H, and there are 5 candles between open and close position, so number of candles will be from 1 to 5 and again 0 after closing position.
Can you put some example please?
Regards
|
|
|
|
|
mad_max
|
Post subject: Re: Candle counter |
Post rating: 0
|
Posted: Wed 30 Jul, 2014, 12:19
|
|
User rating: 0
Joined: Mon 07 May, 2012, 07:24 Posts: 69 Location: CroatiaCroatia
|
Hello Amine.
After yours examples, got it finally!
Thank You! Regards
|
|
|
|
|
mad_max
|
Post subject: Re: Candle counter |
Post rating: 0
|
Posted: Mon 04 Aug, 2014, 21:05
|
|
User rating: 0
Joined: Mon 07 May, 2012, 07:24 Posts: 69 Location: CroatiaCroatia
|
Hello Amine. Just a little update... Is it first IF block (rounded in picture) absolutely necessary? Isn't enough just check state position (filled) in second IF block? I ask this to avoid redundancy. Regards
Attachments: |
counter.png [30.94 KiB]
Downloaded 318 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.
|
|
|
|
|
|
amine_chourou
|
Post subject: Re: Candle counter |
Post rating: 1
|
Posted: Tue 05 Aug, 2014, 10:13
|
|
Visual JForex expert at Dukascopy | |
User rating: 288
Joined: Thu 18 Apr, 2013, 09:26 Posts: 1496 Location: Switzerland, Geneva
|
Hi there,
Well it's good question. Obviously a simple check of position state should be sufficient but for the time being the system 'read' this condition with the assumption that position variable should have a value (Created/opened/filled/closed etc) and often when we work with position variables (except when we use position viewer block) the direct verification of the position state generate an error as the system consider that position variable gets already an assigned value which is not always the case: for instance, when a position is not created yet (Value null). Therefore, this block is a simple check that make sure position variable gets a value. When using position viewer block, I believe such condition is not mandatory as the iteration clears out empty variables and takes into account variables that has a value. Hope this clear enough for you.
Beside that, this 'NoValue' can be used for other variables to avoid useless checks and errors.
Cheers
|
|
|
|
|
mad_max
|
Post subject: Re: Candle counter |
Post rating: 0
|
Posted: Tue 05 Aug, 2014, 12:17
|
|
User rating: 0
Joined: Mon 07 May, 2012, 07:24 Posts: 69 Location: CroatiaCroatia
|
amine_chourou wrote: Hi there,
Well it's good question. Obviously a simple check of position state should be sufficient but for the time being the system 'read' this condition with the assumption that position variable should have a value (Created/opened/filled/closed etc) and often when we work with position variables (except when we use position viewer block) the direct verification of the position state generate an error as the system consider that position variable gets already an assigned value which is not always the case: for instance, when a position is not created yet (Value null). Therefore, this block is a simple check that make sure position variable gets a value. When using position viewer block, I believe such condition is not mandatory as the iteration clears out empty variables and takes into account variables that has a value. Hope this clear enough for you.
Beside that, this 'NoValue' can be used for other variables to avoid useless checks and errors.
Cheers Hello! I'm glad to ask this. From now on I will implement this solution into my strategies. Regards
|
|
|
|
|
|
Pages: [
1
]
|
|
|
|
|