Dukascopy
 
 
Wiki JStore Search Login

I think I am doing Loop wrong
 Post subject: I think I am doing Loop wrong Post rating: 0   New post Posted: Mon 06 Jul, 2015, 14:07 
User avatar

User rating: 1
Joined: Tue 12 May, 2015, 18:13
Posts: 34
Location: United Kingdom, Headington
Sorry if this has been answered I searched the forums and watched many of the videos but without figuring it out.

I want to take the last 5 candles as an array, iterate it through a loop, and take the current high and low values and store them into variables. This is so I can calculate the range of the last 5 candles.

I tried using the : Loop, If High>Loop High, assign High with loophigh method but that just sets a highest and lowest throughout the entire historical test until new high/low is made.
I tried using this method I attached but that does not work either. Thank you again for the support


Attachments:
looptester_HL.vfs [28.11 KiB]
Downloaded 145 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: I think I am doing Loop wrong Post rating: 1   New post Posted: Tue 07 Jul, 2015, 12:39 
Visual JForex expert at Dukascopy
User avatar

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

If you need to use each high and low variables of every candle within your range, then you don't need to use any loop as you can achieve that using couple of 'get historical candle' blocks using shift variable every-time (if you want to retrieve a reasonable number of historical candles) but if you need more, then you have to implement a counter that will increment the value of your shift value dynamically.


 
 Post subject: Re: I think I am doing Loop wrong Post rating: 1   New post Posted: Wed 08 Jul, 2015, 16:52 
User avatar

User rating: 1
Joined: Tue 12 May, 2015, 18:13
Posts: 34
Location: United Kingdom, Headington
hey amine, I just want the high and low of the range itself, not the high and low of each candle


 
 Post subject: Re: I think I am doing Loop wrong Post rating: 0   New post Posted: Wed 08 Jul, 2015, 18:40 
User avatar

User rating: 1
Joined: Tue 12 May, 2015, 18:13
Posts: 34
Location: United Kingdom, Headington
Image

here is my current set up , it just keeps updating the highest high and lowest low, I JUST want the highest high and lowest low of the 5 candle range preceding candle 0


 
 Post subject: Re: I think I am doing Loop wrong Post rating: 0   New post Posted: Wed 08 Jul, 2015, 21:14 
User avatar

User rating: 94
Joined: Mon 06 Feb, 2012, 12:22
Posts: 357
Location: Portugal, Castelo Branco
Hi

Neverless the situation, you need to go over the high and low of any of the candles if you want to get at end the range between them.
I made one fast try at VJF, not tested, but it will be something like the vfs i put in annex. Your code must continue at the end cycle node of loop.

I hope that helps.

Regards

JL

EDIT: I made a change to calculate the range in pricevalue... if you need pips, need to multiply the range variable with pipscale.
If you ask why i place shift = 1 in get candles, is because with shift 0 you get the value of the candle in construction (not finished yet).

EDIT2: Do not forget to reset the values of high variable to 0 and low variable to 999 before use.


Attachments:
File comment: with price range
CandlesHL1.vfs [30.22 KiB]
Downloaded 144 times
CandlesHL.vfs [27.04 KiB]
Downloaded 157 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: I think I am doing Loop wrong Post rating: 1   New post Posted: Thu 09 Jul, 2015, 13:20 
Visual JForex expert at Dukascopy
User avatar

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

Here you go


Attachments:
Get_highestAndLowestCandleData.vfs [32.8 KiB]
Downloaded 211 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