Relative buy signal (Bollinger)
Forums › ProRealTime English forum › ProOrder support › Relative buy signal (Bollinger)
- This topic has 9 replies, 2 voices, and was last updated 6 years ago by CJMolin.
Tagged: Bollinger
-
-
10/17/2018 at 1:50 PM #82968
Hello!
I’m a rookie when it comes to trading but I’m very interested in evolving within this area.
I just started to use PRT and I would like to find a good automatic strategy (don’t we all?). The way I’m trying to configure my strategy isnt really working because I need to enter the code-console and modify the code to be a little bit more complex than the regular UI allows me to build.
Is there any kind soul out there that would bother to help me with the code?
Criterias (see attached picture for number examples [1224.35] / [1227.00]):
- EXAMPLE: Go long WHEN; [Price (X)] / [Bolinger – (Y)] <= 0,99
- EXAMPLE: Go short WHEN; [Price (X)] / [Bolinger + (Z)] >= 1,01
I would very much appreciate help solving this!
Thanks in advance,
CJ
10/17/2018 at 2:15 PM #8297410/17/2018 at 2:23 PM #82976Hello Nicolas,
Y and Z are points yes. Im trying to use this for backtesting as a start. I’ve tried to write some code by my own but it doesnt seem to do that I want.
123456789101112131415161718192021222324// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivated// Conditions to enter long positionsGoLong = close/BollingerDown[20](close)c1 = (GoLong >= 0.9984)IF c1 THENBUY 1 CONTRACT AT MARKETENDIF// Conditions to enter short positionsGoShort = close/BollingerUp[20](close)c2 = (GoShort <= 1.001)IF c2 THENSELLSHORT 1 CONTRACT AT MARKETENDIF// Stops and targetsSET STOP pLOSS 4SET TARGET pPROFIT 610/17/2018 at 2:37 PM #82977> For clarity of messages on ProRealCode’s forums, please use the “insert code PRT” button to separate the text of the code part! Thank you! <<
Well, firstly did you try to graph your conditions?
12graph c1 as "buy condition"graph c2 as "sell condition"So that you see clearly when a condition is met or not.
10/17/2018 at 2:56 PM #82981Oh thank you. I will do that in the future.
Yes I have tried to backtest it. currently im trying out the long-position.
As you can see in the attached picture you can see the code. Im trying to get -> IF price / bollinger down, in this example bollinger down is 1185 and price is 1183. 1183 / 1185 = 0,998. In the code im trying to specify so that take LONG position if the quote of price / bollinger down < 0.999 which would then go long in this example.. but it doesnt! Any clue why? Thank you for your fast replies btw!
1234567GoLong = close/BollingerDown[20](close)c1 = (GoLong < 0.999)IF c1 THENBUY 1 CONTRACT AT MARKETENDIF10/17/2018 at 4:20 PM #8298810/18/2018 at 7:47 AM #83045Hello,
I was trying to apply it on Gold 15 min. But although my attached example above was not triggered.. So it seem to be something wrong with my code, dont you think when looking at the example above? Thank you for trying out the code in your system!
10/18/2018 at 10:28 AM #83062Hi again Nicolas,
Basically what I want to do is a) Measure the difference between PRICE (not closing price) and BOLLDOWN. If the quota of these two variables (PRICE / BOLLDOWN) are for example <= 0,97 THEN I would like to go long with 1 contract. It feels like my code should do the work but when validating it by taking samples it doesnt take positions where I want it to.
Thank you,
CJ
10/18/2018 at 12:49 PM #83084Ok, I modify the logic of your code, I made 2 settings for the orders to trigger if the Close exceed the Bollinger Down (for a buy order) or the Bollinger Upper band (for a short order). The triggers are in percentage.
12345678910111213141516171819// Definition of code parametersDEFPARAM CumulateOrders = False // Cumulating positions deactivatedbuypercent = 0.1sellpercent = 0.1bc = (bollingerdown[20]-close)/bollingerdown[20]sc = (close-bollingerup[20])/bollingerup[20]if bc>=buypercent/100 thenbuy at marketendifif sc>=sellpercent/100 thensellshort at marketendifset target pprofit 10set stop ploss 2010/19/2018 at 10:16 AM #83167 -
AuthorPosts
Find exclusive trading pro-tools on