Calling an indicator from a system
Forums › ProRealTime English forum › ProOrder support › Calling an indicator from a system
- This topic has 19 replies, 3 voices, and was last updated 3 years ago by Nicolas.
-
-
02/21/2021 at 2:08 PM #162189
Is it possible too write an indicator with different timeframes and then call “Long” from a system? Cant get this too work out as I want.
Indicator for long position12345678910111213141516171819202122232425262728// ============================= Variabler för olika tidsintervallTIMEFRAME(1 hours,updateonclose)ma1 = average[20](close)c11 = ma1 > ma1[1] // Lång positionTIMEFRAME(30 minutes,updateonclose)ma304 = Average[4](typicalPrice)ma308 = Average[8](typicalPrice)c301 = ma304 > ma308 // Lång positionTIMEFRAME(15 minutes,updateonclose)indicator2 = Average[4](typicalPrice)indicator3 = Average[8](typicalPrice)c151 = (indicator2 > indicator3) // Lång positionTIMEFRAME(10 minutes,updateonclose)indicator4 = SuperTrend[1.4,6]c101 = close > indicator4 // Lång positionTIMEFRAME(5 minutes,updateonclose)ma5 = average[20](typicalPrice)c51 = ma5 > ma5[1] // Lång positionIF c11 AND c301 AND c151 AND c101 AND c51 THENLONG = 1ENDIFreturn LONG AS "LONG"02/21/2021 at 2:39 PM #162195Yes. Use the CALL instruction in your strategy.
https://www.prorealcode.com/documentation/call/
However it is normally easier and more efficient just to hard code the indicator into your strategy.
Also remember that you will need to run the strategy in a time frame that is compatible with the fastest time frame used in your indicator.
Note: I gave your topic a more meaningful title – please try to use more descriptive titles with future topics.
02/21/2021 at 3:01 PM #16219802/21/2021 at 4:19 PM #162235Yes.
Personally I would just cut and paste the code (removing the RETURN line) into a strategy and then replace LONG = 1 on line 25 with BUY 1 CONTRACT AT MARKET thus avoiding using the CALL instruction entirely.
1 user thanked author for this post.
02/21/2021 at 4:25 PM #16223602/21/2021 at 4:31 PM #16223702/21/2021 at 5:07 PM #162241Even if I make a simple system as this ProRealTime give me a probacktest.error.parsing. Is it just me that have that problem?
I contacted ProRealTime but they don’t answer me… is this a known problem or am I doing something wrong?
suck Indicatore12c11 = close crosses over average[20]return c11 AS "c11"suck_system12345DEFPARAM CumulateOrders = falsec11 = CALL "suck"IF c11 THENBUY 1 Contract AT MarketENDIF02/21/2021 at 5:21 PM #16224402/21/2021 at 5:22 PM #16224502/21/2021 at 5:25 PM #16224602/21/2021 at 5:29 PM #162247There was a discussion in the French forum last October about similar issues.
https://www.prorealcode.com/topic/probacktest-error-parsing/
The best work around is to avoid using CALL and hard code the indicator in your strategy for the time being.
1 user thanked author for this post.
02/21/2021 at 5:30 PM #16224802/21/2021 at 5:33 PM #162250Yes that is the best way to do it. We may have to wait for PRT to investigate and fix this ‘parsing’ error before being able to code in this way though.
Out of interest I just tested your simple test code on the DAX 5m and it worked just fine for me.
1 user thanked author for this post.
02/21/2021 at 5:37 PM #16225102/21/2021 at 5:58 PM #162254 -
AuthorPosts
Find exclusive trading pro-tools on