Dukascopy
 
 
Wiki JStore Search Login

Finding Maximum and Minimum value for X candle bars
 Post subject: Finding Maximum and Minimum value for X candle bars Post rating: 0   Post Posted: Mon 26 Oct, 2015, 09:35 
User avatar

User rating: 0
Joined: Tue 29 Sep, 2015, 22:39
Posts: 7
Location: Saudi Arabia, Jeddah
Hi,

I would like to find the Maximum and Minimum value from 'X' number of candle bars (1 hour) for my VJF strategy creation. Please let me know the best way to get this value.

I have used Fractals with following values in "onTick",

Instrument: GBPUSD
Period: 1 hour
Shift: 2
Number of bars on sides: 2

But I am not sure whether the resultant Minimums and Maximums are the one which I am expected. Because when I used to open trades using this value, it is just creating an order randomly.

I have searched in wiki, but I couldn't find help related to this with respect to VJF. Kindly help!


 
 Post subject: Re: Finding Maximum and Minimum value for X candle bars Post rating: 1   Post Posted: Mon 26 Oct, 2015, 14:42 
Visual JForex expert at Dukascopy
User avatar

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

You use of the fractal indicator is correct but if it doesn't meet your expectations then you might need something else:
I found the below thread that treated almost the same topic, check the attached example at the bottom and adjust the trading period as per your need.

https://www.dukascopy.com/swiss/english ... igh#p84891

If this doesn't help either, let me know

Cheers


 
 Post subject: Re: Finding Maximum and Minimum value for X candle bars Post rating: 0   Post Posted: Mon 26 Oct, 2015, 22:22 
User avatar

User rating: 0
Joined: Tue 29 Sep, 2015, 22:39
Posts: 7
Location: Saudi Arabia, Jeddah
Hi,

Thanks for the link, it helped.

But my strategy is not working correctly. Can you please check what is wrong?

I have created a strategy to find the Highest/Lowest from last 15 candles. If following candle crosses the highest, then a Pending buy position will be created with last candle high. Same way, If following candle crosses the lowest, then a Pending sell position will be created with last candle low. But it is not working as expected.

Unfortunately, I am not able to attach the VFS file. Hence I will detail by strategy. I used "All positions" to open only one order at a time. Then I used your VFS to determine the Highest/Lowest from last 15 bars. Then I just check the Last candle high with Highest for pending buy position and last candle low with lowest for pending sell position. Pending order entry value will be decided again by last candle high/low respectively.

Also, I would like to know if there is a way to find the number of "Open buy position" and "Open sell position" separately.

And one more query, How I can check 2 candle periods in same strategy?


 
 Post subject: Re: Finding Maximum and Minimum value for X candle bars Post rating: 1   Post Posted: Tue 27 Oct, 2015, 11:47 
Visual JForex expert at Dukascopy
User avatar

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

You can find attached another example that retrieves highest and lowest prices from a given number of previous candles (26 and 9 used in this example).
If you're unable to attach your vfs file to this post then please send it to [email protected] (attention to Amine)

Quote:
Also, I would like to know if there is a way to find the number of "Open buy position" and "Open sell position" separately.

You need to use "Position Viewer" block to store your open positions info and then within the Position output that you will create, you can see that there is a Boolean variable called "Position is Long": You can use this variable in an IF block and if it is = True --> The position is effectively Long / if False --> Short

Quote:
How I can check 2 candle periods in same strategy?


By avoiding the use of "Default period" variable otherwise the strategy will consider this as default. Depending on your specifications, there is several ways to use different periods. It can be set differently in indicators for instance or if you need to use candle's data you do it using "Get historical candle" with a dedicated period for each.

Hope this helps


Attachments:
Highest_Lowest_V2.vfs [37.48 KiB]
Downloaded 156 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: Finding Maximum and Minimum value for X candle bars Post rating: 0   Post Posted: Tue 27 Oct, 2015, 20:44 
User avatar

User rating: 0
Joined: Tue 29 Sep, 2015, 22:39
Posts: 7
Location: Saudi Arabia, Jeddah
Hi,

Thanks for your reply!

Can you please post an example for "Position viewer" usage in VJF?

I would like to see "Position viewer" being used to avoid repetitive LONG/SHORT trade in a pair.


 
 Post subject: Re: Finding Maximum and Minimum value for X candle bars Post rating: 0   Post Posted: Wed 28 Oct, 2015, 11:56 
Visual JForex expert at Dukascopy
User avatar

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

Here is a simple example but there is other ways to do the same Job depending on the trading idea.
By the way, "Trade Event" start point has also the ability to identify the position side.

Cheers


Attachments:
OrderSide_PositionViewer.vfs [28.12 KiB]
Downloaded 150 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:  

  © 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