How to trade on this?
Forums › ProRealTime English forum › ProOrder support › How to trade on this?
- This topic has 5 replies, 2 voices, and was last updated 6 years ago by robertogozzi.
-
-
11/20/2017 at 2:35 PM #53307
Im still fairly new and learning to code. So far i have not touched indicators, so im wondering:
How do you code this: https://www.prorealcode.com/prorealtime-indicators/williams-highs-lows/
So that it takes trade long and short on every ellipse? (edit: i mean Long on arroup + ellipse and Short on arrowdown + ellipse)
Big thanks 🙂
ps: i have tried, i just cant get it to work!
11/20/2017 at 3:53 PM #53318Use the “Insert/edit link” button to make a web reference clicky:https://www.prorealcode.com/prorealtime-indicators/williams-highs-lows/. You can either copy & paste it into your strategy (removing return and all graphical instructions), assigning each event a different value to a variable, or you may change the indicator to return a value according to what it detects, instead of displaying arrows and ellipses, something like this:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354//computation of the radius to draw ellipsesReturnValue = 0 (1= ellipse 2=arrowdown 3=arrowup)radius=average[200](range)/4//formula to compute short term swing pointsif (high>alto[1]) and not (high<high[1] and low>low[1]) thenalto=highbasso=lowmarkup=barindexmarkhigh=highendifif (low<basso[1]) and not (high<high[1] and low>low[1]) thenalto=highbasso=lowmarkdown=barindexmarklow=lowendifif alto<alto[1] and trend=1 thentrend=0ReturnValue = 2drawarrowdown(markup,markhigh)mediummarkup=shortmarkupshortmarkup=markuplongmarkhigh=mediummarkhighmediummarkhigh=shortmarkhighshortmarkhigh=markhigh//intermediate high swing pointsif longmarkhigh<mediummarkhigh and mediummarkhigh>shortmarkhigh thenReturnValue = 1DRAWELLIPSE(mediummarkup-1, mediummarkhigh-radius, mediummarkup+1, mediummarkhigh+radius)endifendifif basso>basso[1] and trend=0 thentrend=1ReturnValue = 3drawarrowup(markdown,marklow)mediummarkdown=shortmarkdownshortmarkdown=markdownlongmarklow=mediummarklowmediummarklow=shortmarklowshortmarklow=marklow//intermediate low swing pointsif longmarklow>mediummarklow and mediummarklow<shortmarklow thenReturnValue = 1DRAWELLIPSE(mediummarkdown-1, mediummarklow-radius, mediummarkdown+1, mediummarklow+radius)endifendif//drawcandle(open,high,low,close)return ReturnValue11/21/2017 at 8:44 AM #5338111/21/2017 at 10:42 AM #53407I am Roberto, not Nicolas.
Line 2 of the above example needs to add “//” (double slashes to comment text) after “=0” or it will trigger an error message.
If you want to use that indicator on the price chart, you don’t have to modify the original code, just use it as is.
The example above was made to be CALLed or embedded in a strategy or, but it’s pretty ugly, displayed under your chart.
To call it from inside your strategy:
1234indicator1 = CALL "My Indicator"IF indicator1 = 1 THEN.... //Ellipse found..11/21/2017 at 1:10 PM #53431Oh lol, sorry Roberto i think i was looking at 2 posts at the same time 😛
I saw the error and added the // but as u can see in the photo i attached, the value of the indicator is alot slower then the arrows and ellipses on the pricechart!
11/21/2017 at 2:52 PM #53464I can’t really detect why it behaves like that. I hope Nicolas can help us.
-
AuthorPosts
Find exclusive trading pro-tools on