Dukascopy
 
 
Wiki JStore Search Login

Getting the weekly open in Visual JForex
 Post subject: Getting the weekly open in Visual JForex Post rating: 0   New post Posted: Tue 18 Jul, 2017, 14:09 
User avatar

User rating: 2
Joined: Fri 27 Jul, 2012, 07:04
Posts: 82
Location: Spain, Paracuellos de Jarama
I need to use the weekly open in my strategy.

For me, the weekly open is the bid price of the first tick after the weekend (when using GMT UTC time setup, it's on sunday at 21:00) .

If I use the block Get Historical Candle with period: Week and shift: 0 (the current unfinished week) and then I display the variable open, I see the price of the first tick on monday, but there are previous ticks on sunday!

Then I tried getting 120 hourly candles (1 week= 5 days *24 hours) using Get Historical Candles, and then with a loop viewer I want to get the open price of the hourly candle with Day of Week = 0 (Sunday) and Hour = 21. But it's not working.

Please can you help me?

I enclose my prototype for your reference


Attachments:
File comment: Prototype to get weekly open
WeeklyOpen.vfs [28.47 KiB]
Downloaded 132 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: Getting the weekly open in Visual JForex Post rating: 1   New post Posted: Wed 19 Jul, 2017, 13:26 
Visual JForex expert at Dukascopy
User avatar

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

According to my understanding this looks quite simple.
Attached an example.

Cheers


Attachments:
firstTickWeek.vfs [19.97 KiB]
Downloaded 135 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: Getting the weekly open in Visual JForex Post rating: 0   New post Posted: Thu 20 Jul, 2017, 02:51 
User avatar

User rating: 2
Joined: Fri 27 Jul, 2012, 07:04
Posts: 82
Location: Spain, Paracuellos de Jarama
Hello Amine and thanks for your answer.

I've looked at your suggestion code and I see a pair problems:

1. The code will return the last tick price that arrives on the first minute of the week. But I need the first tick price!
2. The code has to be running at the beginning of the week to get the price, and if the strategy is stopped in the middle of the week, it can't be used again until the next sunday.

I have another simpler program for that (running since sunday night):

User Variable  FirsTick Boolean Initial Value: True
User Variable WeeklyFirstPrice Double

OnTick -> If FirstTick = True -> If LastTickInstrument = DefaultInstrument -> Assign False to FirstTick -> Assign LastTickBid to WeeklyFirstPrice


But it has the same problem: It has to be started on sunday and if it's stopped in the middle of the week you have to wait until next sunday.

I need to get the first price of the week from the first historical candle on sunday night to be able to start running the strategy at any moment during the week.

Cheers

Francisco


 
 Post subject: Re: Getting the weekly open in Visual JForex Post rating: 1   New post Posted: Thu 20 Jul, 2017, 12:20 
Visual JForex expert at Dukascopy
User avatar

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

I see the requirement now.
Try the attached and let me know please.


Attachments:
firstTickWeek_WA2.vfs [21.38 KiB]
Downloaded 151 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