Custom Indicator Error in Strategy
Forums › ProRealTime English forum › General trading discussions › Custom Indicator Error in Strategy
- This topic has 6 replies, 3 voices, and was last updated 4 years ago by GraHal.
-
-
10/10/2020 at 1:58 PM #146980
Dear All,
I am a newbee to proReal and your kind help will be appreciated. As part of my practice, I am trying to develop a a simple strategy using a custom indicator I have developed.
1234567891011121314151617181920212223242526272829defparam cumulateorders = false//Mahwe Money ManagementCapital = 1000Risk = 0.01StopLoss = 10//Mahwe Calculate contractsequity = Capital + StrategyProfitmaxrisk = round(equity*Risk)PositionSize = abs(round((maxrisk/StopLoss)/PointValue)*pipsize)mySTRONGBUY, myBUY, mySTRONGSELL, mySELL, myNeutral = CALL “#pivotPointAvg”(close)Condition1 = CALL “#pivotPointAvg”(close)IF Condition1 = mySTRONGBUY OR myBUY THENBUY PositionSize Share AT MARKETENDIFIF LONGONMARKET AND Condition1 = myNeutral THENSELL PositionSize share AT MARKETENDIFIF Condition1 = mySTRONGSELL OR mySELL THENSELLSHORT PositionSize share AT MARKETENDIFIF SHORTONMARKET AND Condition1 = myNeutral THENEXITSHORT AT MARKETENDIFHowever I am getting the below screen error:
Syntax error: The function “#pivotPointAvg” called from “AlgoTrading” returns 5 values but your code needs 1.
I want my strategy to choose only 1 value from the 5 values generated by my custom indicator so that my Buyor sell condition is triggered – can you kindly direct me where I am getting it wrong?
Happy trading to all!
Thanks
10/10/2020 at 4:31 PM #14700210/10/2020 at 4:37 PM #147003The error refers to line 14, you need to use a variable for ALL returned values, if you don’t need sone use the keyword ignored instead of a name.
Like in line 13.
If you search the forum for CALL you will find the official description and many examples on how indicators are CALLed.
10/10/2020 at 9:37 PM #147011What should be deleted?
My message. Thank you.
I jumped in and mentioned use of ‘ignored’, but then I read his code and saw that he uses all the returned values in his strategy.
10/10/2020 at 9:42 PM #147012@Widzo below is one of the links to what Roberto is referring.
https://www.prorealcode.com/documentation/call/
10/10/2020 at 10:12 PM #147014Thank you so much @GraHal and @robertogozzi for your help! let me follow through your recommendation.
10/11/2020 at 11:46 AM #147041 -
AuthorPosts
Find exclusive trading pro-tools on