Dukascopy Support Board

Get historical Datas without weekend flat candles
Page 1 of 1

Author:  powerof618 [ Sun 17 Mar, 2019, 19:53 ]
Post subject:  Get historical Datas without weekend flat candles

I want to use the datas of the last 3 candles on the 4H chart. During the week it works fine, but on sunday and the first 2 candles on monday it seems, that my strategy does not work. The flat weekend candles should not be calculated. I tried to use the GetTimeUnit block, but I am not able to fix that problem. Anyone here, who can help me? Thanks a lot.

best regards


File comment: Strategy
last_3_candles.vfs [42.49 KiB]
Downloaded 32 times
File comment: 1st candle Monday 00:00 UTC
monday_0_00.png [15.33 KiB]
Downloaded 66 times
File comment: 2nd candle Monday 04:00 UTC
monday_4_00.png [15.44 KiB]
Downloaded 65 times
File comment: 1st candle Sunday 20:00 UTC
sunday_open.png [15.28 KiB]
Downloaded 60 times

Author:  FranklinXiao [ Wed 20 Mar, 2019, 14:40 ]
Post subject:  Re: Get historical Datas without weekend flat candles

Here are my idea for your reference:
1. check what value you look for from last 3 candles
2. create 3 new varibles to prepare record the value you look for, variable 1, variable2, variable 3
3. use get time block and "if" logic to filter the candles among Monday and Friday
4. If above point3 is true, First, assign variable 1 to varibale2, then assign v2 to v3, finally assgin last candle's value to variable1. This logic is trigerred every 4H candle opening.
5. wait three 4H, you would get three different variables.

In the point 3, you need to check both time "day" and time "hour" to get the accurate candles. I didn't try but it should work.

Additionally, you can also try to use look back logic, for example:
1. create a variable, named 'Lookback'
2. If lookback <3, then lookback+1 in itself
3. put lookback to the "shift" place of get historical candle
4. time filter logic as above to assign candle's value to variables.

I am not familar with the get historical candleS, maybe someone could have better logic than mine, you can search in forum.

  Page 1 of 1