Simple code returns error message
Forums › ProRealTime English forum › ProOrder support › Simple code returns error message
- This topic has 21 replies, 4 voices, and was last updated 5 years ago by
GraHal.
-
-
03/04/2020 at 4:16 PM #121152
Completely new to coding so started a simple test program got error msg to go to prorealcode but thats too complex. Advice welcome
12345678910111213// Conditions to enter long positionsDEFPARAM CumulateOrders = FalseDEFPARAM FlatBefore = 065000DEFPARAM FlatAfter= 203000mm=ExponentialAverage[20](close)if mm>mm[1]thenBUY 100 SHARES AT MARKETSET STOP $LOSS10endif03/04/2020 at 4:25 PM #121154AT line 12 leave a blank between LOSS and 10.
03/04/2020 at 5:42 PM #12116903/04/2020 at 5:50 PM #12117203/04/2020 at 5:52 PM #121173There you go:
12345// Stochastic(8,4,3)StocK = Stochastic[8,4](close)StocD = Average[3,0](StocK)x = StocK CROSSES OVER StocD //Crossing OVERy = StocK CROSSES UNDER StocD //Crossing UNDER1 user thanked author for this post.
03/05/2020 at 2:33 PM #12125403/05/2020 at 2:38 PM #121255Is this what you mean …
123If condA AND condB AND condC ThenBuy at MarketEndif2 users thanked author for this post.
03/05/2020 at 5:36 PM #12128403/07/2020 at 9:19 AM #121429Does the command need to be in one long string ?
Yes, but you can do same / similar to below.
The auto-syntax checker is very good if you make a mistake it will let you know when you try and run the code.
1234567CondA = Average[20] (Close)CondB = Average[50] (Close)CondC = CondA crosses over CondBIf condC ThenBuy at MarketEndif03/08/2020 at 9:09 PM #12149703/08/2020 at 9:23 PM #12149803/11/2020 at 4:33 PM #121838Thank you Roberto…
I have just tried to backtest this simple program but the syntax error now
underlined is the > symbol, third line up (>80) What have I done wrong ?1234567891011121314151617DEFPARAM CumulateOrders = FalseDEFPARAM FlatBefore = 081500DEFPARAM FlatAfter= 160000StocK = Stochastic[15,3](close)StocD = Average[3,0](StocK)y = StocK CROSSES UNDER StocDIf average [50](close)>average[50](3) thenIf StocK<20 and y thenBuy at marketSet stop loss 15EndifEndif// sell conditionIf StocK = Stochastic[15,3](close)>80 thenSell at marketEndif03/11/2020 at 4:41 PM #12183903/11/2020 at 4:46 PM #121840This could be the error, at line 8:
1average[50](3)what is the number 3 within parentheses? That’s the place where you put the data series on which the average is computed, CLOSE, HIGH, StocK, Rsi….. not 3!
(when omitted, the CLOSE is assumed)
03/11/2020 at 4:50 PM #121844Also, line 15 should be:
123If StocK >80 then// orIf Stochastic[15,3](close)>80 then1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on