How to reset variables
Forums › ProRealTime English forum › ProOrder support › How to reset variables
- This topic has 5 replies, 2 voices, and was last updated 5 years ago by
Nicolas.
-
-
09/30/2020 at 11:41 AM #145947
Im still stuck on this.
123456789101112131415161718once trigger = 0if trigger = 0 and high < bolldown thentrigger = 1triggersignal = barindexendifif (barindex-triggersignal) >8 thentrigger = 0endifif trigger = 1 and close > bollup thentrigger = 2endifIF Trigger = 2 and c1 and close>c2 AND Not OnMarket and not daysForbiddenEntry THENBUY 1 Contract AT MarketSET TARGET pPROFIT 10SET STOP ploss 10Trigger = 0ENDIFFrom what i understand the trigger = 1 is not reset and keeps adding. How do i reset all variables after trade.
09/30/2020 at 12:06 PM #14595109/30/2020 at 12:15 PM #145954How do i reset variable 1 if the conditions for variable 2 arent met?
I tried to reset it 8 bars after variable 1, seems to not work.
09/30/2020 at 1:01 PM #14596709/30/2020 at 1:21 PM #145970When the high is < bolldown this is variable 1. I named it trigger = 1.
When trigger = 1 is active and within 8 bars if price closed above bollup i named it trigger =2 ( variable 2).
If it dosent close above bollup within 8 bars i tried to reset it back to trigger =0.
Im sorry i know my explanation is a little confusing.
1234567891011121314151617181920212223242526272829303132Defparam cumulateorders = falseDEFPARAM FLATBEFORE = 090000DEFPARAM FLATAFTER = 160000daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0//INDICATORSc1 = AverageTrueRange[14](close) > 2c2 = ExponentialAverage[200](close)Bollup = CALL "Example2 : Bollinger(1)upup"[0.66, 10]Bolldown = CALL "Example2 : Bollinger(1)down"[0.66, 10]//SIGNALSonce trigger = 0ONCE trigger = 1if trigger = 0 and high < bolldown thentrigger = 1triggersignal = barindexendifif (barindex-triggersignal) >8 thentrigger = 0endifif trigger = 1 and close > bollup thentrigger = 2endif//BUY CONDITIONSIF Trigger = 2 and c1 and close>c2 and bolldown > c2 AND Not OnMarket and not daysForbiddenEntry THENBUY 1 Contract AT marketSET TARGET pPROFIT 10SET STOP ploss 10Trigger = 0ENDIFThis is the full code.
09/30/2020 at 1:52 PM #145972If you GRAPH trigger, you will see at what moment the variable is set to what value, did you try? This is the first step to understand why a code is not functioning at it should, GRAPH the variables! 😉
1 user thanked author for this post.
-
AuthorPosts
