Hi can anyone advice me on the correct way to code multi timeframes ?
The issue I’m have every time the code is triggered it only takes in to account the smaller TF . Could it be that the 10 minute TF takes in to account c1 and c2 rather than them working in sync with each other ( what I want is provided the 4h TF (c1) is correct then it will go ahead and activate the trade on the smaller TF (c2)
any help will be very much appreciated.
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Prevents the system from placing new orders on specified days of the week
daysForbiddenEntry = OpenDayOfWeek = 6
// Conditions to enter long positions
timeframe(4h)
ignored, indicator1 = CALL "Storyteller 3.0"[1]
c1 = (indicator1 > 0)
timeframe(10 minutes)
indicator3, indicator4 = CALL "Storyteller 3.0"[1]
c2 = (indicator3 crosses over indicator4)
IF (c1 AND c2) AND not daysForbiddenEntry THEN
BUY 1 PERPOINT AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 100
SET TARGET pPROFIT 100
I want is provided the 4h TF (c1) is correct
As your code is written, anytime c1 = indicator1 > 0 during a 4 hour bar, then C1 will be True / 1.
So C1 may be coincident with C2 6 times per hour at the end of each 10 minute bar (assuming your Chart is running on 10 min Timeframe?).
If you want C1 to be checked ONLY at the end of each 4 hour bar, then you need to use …
Timeframe(4h, updateonclose)
ignored, indicator1 = CALL “Storyteller 3.0”[1]
c1 = (indicator1 > 0)
As it stands at the moment c2 ( 10 min TF ) will take all long positions irrelevant whether or not c1 (4h TF) is above or below the 0 line , meaning its entering a long position during a down trend on the 4h . I’ve tried updateonclose and it appears not to make ant difference.
thanks.
Is your backtest chart running on 10 min Timeframe?
Hi yes the charts is running on the 10 min tf for position entries .
Why are you using “Storyteller 3.0”[1] and not “Storyteller 3.0” ?
hi I’ve tried using storey teller 3.0 and also just tried using a different indicator ( MACD) and getting the same results back , taking long positions even when the 4h tf ( MACD) is below the 0 line . Just cant get them to work in sync with each other >
Post your code with the MACD and I will try on my Platform.
I am more of a ‘trial and error coder’. It’s not easy for me to see what might be going wrong without testing your code.
I am wanting to help andyfx79 to move onward and upward … so if anybody can see the problem then please join in and tell us! 🙂
Use …
C3 = C1 AND C2
GRAPH C3
to see if C3 confirms (or not?) what you think is happening?
I’ve added c3 to the code and it confirms that c1 and c2 are not in sync using the storey teller , however it seems to work using the macd so I’ve come to the assumption that the issue lies within the storey teller indicator ,
If you want help just share “Storyteller 3.0” indicator.