Dukascopy
 
 
Wiki JStore Search Login

Find Last Volume High
 Post subject: Find Last Volume High Post rating: 0   Post Posted: Wed 13 Jul, 2016, 17:34 
User avatar

User rating: 1
Joined: Thu 23 Jun, 2016, 11:36
Posts: 45
Location: AustriaAustria
Hi - I'm trying to find a way of identifying the the most recent (last) volume high. That means of course that I don't know how many bars back it is. And if I understand loop viewer (along with get historical candles), I am restricted because get historical candles needs me to specify the number of bars for the array to be looped through.

So I thought the flow in the attached might work for such a situation. The idea is to increment the shifts for 3 consecutive volume bars until the first high is detected. So I thought that when the on candle start triggers, then it would increment immediately through the volume bars until the first high was detected, and then assign that value to VOLHIGHOVERNIGHT. Well, it does increment ok but only after each new candle. So it can never find the last volume high (unless by chance it just happened to be in the very first 3 bars).

I would really like to know why this doesn't work because it seems like I don't understand something basic about VJF. If I was programming this in Java/MQL it would be straightforward. The historical volume bars would be looped through immediately and not on the basis of each new candle. So the volume high would also be detected immediately

I guess I could specify a big number for the get historical candles array, and assume that the first high falls within that range (seems reasonable). But is there a solution that deals with arrays of unknown size, and identifies the most recent high immediately?

thanks


Attachments:
Find_LAST_vol_High.vfs [35.75 KiB]
Downloaded 122 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 Last Volume High Post rating: 1   Post Posted: Thu 14 Jul, 2016, 09:41 
Visual JForex expert at Dukascopy
User avatar

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

Identifying the most recent High is indeed based on logic comparison. We need to compare the volume of a given bar with another and check which is the highest. I see 2 possible ways to do that:
- Most recent high: simply compare the last completed candle's volume with the previous one and you'll get the highest value. Therefore it is quite basic, but you would need to define how "recent" goes far in the past, thus you'll fall in determining an array of candles
- Start with an array (get historical candles) and determine your highest value: this is not really the solution you're looking for.

In both cases, we're getting back to using an array as input.

One more detail: I'm not sure if you noticed that the Volume indicator is exactly the same as the candle's volume that you can get form get historical candle(s) blocks


 
 Post subject: Re: Find Last Volume High Post rating: 0   Post Posted: Thu 14 Jul, 2016, 10:16 
User avatar

User rating: 1
Joined: Thu 23 Jun, 2016, 11:36
Posts: 45
Location: AustriaAustria
Okay thanks. I will try with the second array approach that you suggest combined with a loop. Once the first high is detected then I will break out of the array.( I'm assuming I can break out of the array before it loops through all of the candles specified in the get historical candles amount field - would that be a correct assumption?).

N.b on your last point I couldn't see any volume in the get historical candles block. Could you point out where exactly I should look. Thank you


 
 Post subject: Re: Find Last Volume High Post rating: 1   Post Posted: Thu 14 Jul, 2016, 10:32 
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 an example, as you can see the volume is used from the array created out of the loop viewer

Image
Image


Attachments:
HighestVolume.vfs [24.7 KiB]
Downloaded 156 times
highestVolume.JPG [52.11 KiB]
Downloaded 387 times
Chart_EUR_USD_10 Secs_snapshot.png [13.79 KiB]
Downloaded 392 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 Last Volume High Post rating: 1   Post Posted: Thu 14 Jul, 2016, 10:42 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
BTW; you can even catch the time of the candle where the highest volume is realized using a second assign block with the candle time value assigned to a new Date &Time variable.


 
 Post subject: Re: Find Last Volume High Post rating: 0   Post Posted: Thu 14 Jul, 2016, 11:34 
User avatar

User rating: 1
Joined: Thu 23 Jun, 2016, 11:36
Posts: 45
Location: AustriaAustria
Thanks a lot. Much appreciated


 
 Post subject: Re: Find Last Volume High Post rating: 0   Post Posted: Thu 14 Jul, 2016, 19:29 
User avatar

User rating: 1
Joined: Thu 23 Jun, 2016, 11:36
Posts: 45
Location: AustriaAustria
Sorry - one last question. I'd really like to know why the incrementing shift loop in the attachment in my earlier post cannot work. It's clear to me from your replies that it cannot work in VJF - although it would be no problem to code and make work if coded directly in java. I realise that VJF cannot do everything that can be done by direct java coding. But an explanation would help me understand the limitations.

As I said in my earlier post, the shifts in my attached VJF file do increment, but only with each on start candle signal. However, based on my mql4 experience, I would expect that if I had coded my VJF file directly in java rather than VJF , any loop, once triggered, is executed to completion (assuming not infinite of course). So in directly coded java, if a tick arrives during the code-execution, then the next tick(s) is ignored until the whole program, including any triggered loops, is executed. But VJF on the other hand does not work this way.

Perhaps it's not an easy thing to explain, but grateful for any view.


 
 Post subject: Re: Find Last Volume High Post rating: 1   Post Posted: Fri 15 Jul, 2016, 10:57 
Visual JForex expert at Dukascopy
User avatar

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

Sorry if I was not clear enough. I'll try to explain things better:
As far as I understood from your description in the previous posts, this is not impossible to be programmed in VJF. Let me first describe what comes from your first example:
Your strategy is performing checks in periodical way, every 3 candles of 10 sec, and catches the highest volume. This cycle is made with the help of shift so every 10 seconds the strategy shift back to 3 candles ago and retrieves the highest volume:


Image

If the above is what you are expecting from the strategy to do then please find below some issues related to the way it is programmed:
- infinite cycles are indeed not allowed: You don't need to link back to create a loop. If you need a loop it can be made using Loop Viewer. In case you need to get the highest volume of this endless checks, then simply create another variable to store the previous HIGH_VOL and keep on comparing it with the current one and assign the biggest value to a new variable: therefore you'll usually get the highest volume out of an indeterminable number of candles. (this is not implemented in the attached example)
- The incrementation of shifts variables are okay, but I noticed that the value is not considered properly in the Volume indicators(I did not check the exact reason to be honest) but I prefer to assign the new result on every cycle which was done in the attached example

Hope this helps

Cheers


Attachments:
Chart_EUR_USD_10 Secs_snapshot_notes.jpg [103.18 KiB]
Downloaded 380 times
Test_VolShifted.vfs [26.05 KiB]
Downloaded 113 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 Last Volume High Post rating: 0   Post Posted: Fri 15 Jul, 2016, 15:32 
User avatar

User rating: 1
Joined: Thu 23 Jun, 2016, 11:36
Posts: 45
Location: AustriaAustria
I'm sure it will help once I've digested at all and also run the file that you sent. Thanks very much for that. Looking at the new chart that you attached I would say that the first high occurs at check 3. Once it picks up the high at 3 then I want to break out of that loop and do the rest of the program. The rest of the program is that once the vol high at 3 is broken then a buy or sell signal will be made.


 
 Post subject: Re: Find Last Volume High Post rating: 1   Post Posted: Fri 15 Jul, 2016, 16:35 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
Actually when reading your reply I realized that there is a mistake in the strategy to meet the above screenshot explanations (or a mistake in my explanations to meet the strategy specifications ;) ):
The counter increments with 1 in the strategy while I'm jumping every cycle with 3 candles so to do so, the counters should increment by 3 and not 1. attached another version.
If you keep it at 1 then the checks will be made this way:

Image


Attachments:
Checks.jpg [17.05 KiB]
Downloaded 342 times
Test_VolShifted_V2.vfs [26.06 KiB]
Downloaded 113 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 Last Volume High Post rating: 0   Post Posted: Sat 16 Jul, 2016, 15:38 
User avatar

User rating: 1
Joined: Thu 23 Jun, 2016, 11:36
Posts: 45
Location: AustriaAustria
Yes the 3 increment chunks it into blocks of 3, yet it looks to me that your 1 increment is still necessary in order to be sure it picks out the high at check 3. But I will test both ways of course!

I would like to clarify the possibility of looping through an array of unknown size. Can this actually be done in VJF? And if so, it would be great if you could give an example of how. thanks.


 
 Post subject: Re: Find Last Volume High Post rating: 1   Post Posted: Mon 18 Jul, 2016, 11:17 
Visual JForex expert at Dukascopy
User avatar

User rating: 288
Joined: Thu 18 Apr, 2013, 09:26
Posts: 1496
Location: Switzerland, Geneva
I guess you're planning to stop this loop if a certain condition is (are) met isn't ?


 
 Post subject: Re: Find Last Volume High Post rating: 0   Post Posted: Mon 18 Jul, 2016, 13:18 
User avatar

User rating: 1
Joined: Thu 23 Jun, 2016, 11:36
Posts: 45
Location: AustriaAustria
Yes, exactly. But I can never know for sure when that condition will arrive. That's why I want to know if I can specify the array in loop viewer but without a given array size. And if not, is there any other way in which this requirement could be achieved.


 
 Post subject: Re: Find Last Volume High Post rating: 1   Post Posted: Tue 19 Jul, 2016, 09:43 
Visual JForex expert at Dukascopy
User avatar

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

Check this example: it looks for the highest price of a candle array that increments every end of loop. The Highest price and its related date are retrieved but the loop size keeps growing with the help of the counter.

Let me know your thoughts

Thanks !


Attachments:
IndeterminedArray.vfs [28.42 KiB]
Downloaded 137 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 Last Volume High Post rating: 0   Post Posted: Wed 20 Jul, 2016, 16:14 
User avatar

User rating: 1
Joined: Thu 23 Jun, 2016, 11:36
Posts: 45
Location: AustriaAustria
Hi - yes it worked well. I also connected the onstart from candle to tick. I did that in order to expand and loop the array near instantaneously rather than wait for each candle to finish. That way I found the high very quickly and can then use that information in the onstart candle side of the strategy. Thanks very much again!


 

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