Support Board
Date/Time: Sun, 29 Dec 2024 15:42:35 +0000
[Programming Help] - How to add up/down arrows to main chart based on hypothetical target/stops being hit
View Count: 1135
[2016-05-13 17:48:48] |
User625293 - Posts: 2 |
Sorry for novice questions, i'm demoing the software and looking for a jumpstart with coding some custom indicators....if you could help me with these two I think I will be able to figure out the others I need. Consider the below pseudo-code. 1. At any bar in main price chart I want an up arrow below the price or a down arrow above the price indicating that my calculated target was hit within 100 bars in the future. So if the price moved up in the future and hit the up target before hitting the down target (up target = down target) there would be an up arrow drawn under the bar whose target was hit in the future, at the time the target was hit. Conversely, if the price hit the down target in the future before the up target there would be a down arrow above the bar whose down target was hit. If neither target got hit w/i 100 bars there would be no arrow. The target percentage is calculated based on volatility and is different at every bar...calculated as: duration = 63; //used for std dev and moving average calc stdDevTR = StDev(abs(TR(1)), duration); //standard deviation of absolute value of true range calculated over the duration mAvgTR = MA(abs(TR(1)), duration); //moving average of absolute value of true range calculated over the duration mAvgTRPlusTwoStDev = mAvgTR + (2 * stdDevTR); //the moving average plus two standard deviations mAvgTRPlusTwoStDevAsPercOfClose = (mAvgTRPlusTwoStDev / C) * 100; //the moving average plus two standard deviations as the percentage of the current close....this is the up=down target for each bar 2. The second custom indicator is a type of money flow or momentum indicator. It calculates the current bar C-O range as a percentage of the average C-O, and the current volume as a percentage of the average volume, with both being positive for an up bar and both negative for a down bar, then adds them together and plots the smoothed EMA as a histogram: duration = 63; CloseMinusOpen = C-O; EMACloseMinusOpen = EMA(ABS(C-O),duration); CloseMinusOpenAsPercOfEMA = IIF((C-O)>0, (CloseMinusOpen/EMACloseMinusOpen), -1*((CloseMinusOpen/EMACloseMinusOpen)); VolumeAsPercOfEMA = IIF((C-O)>0, V/EMA(V,duration), -1 * (V/EMA(V,duration))); CloseMinusOpenAsPercOfEMAPlusVolumeAsPercOfEMA = CloseMinusOpenAsPercOfEMA + VolumeAsPercOfEMA; EMAOfEMAOfCloseMinusOpenAsPercOfEMAPlusVolumeAsPercOfEMA = EMA(EMA(CloseMinusOpenAsPercOfEMAPlusVolumeAsPercOfEMA,duration),5); //smoothing //the above would then be plotted as a histogram. I would like to implement the above in as simplest/quickest way as possible. If I have to get into ASCIL and Visual C++ I will if that is your recommended approach, although it has been a few years since I've coded anything. Any sort of example or a start you could provide would be most appreciated. Thank you. Lewis |
[2016-05-13 18:01:32] |
Sierra Chart Engineering - Posts: 104368 |
We do not provide programming help. For what you want to do we recommend using ACSIL: Advanced Custom Study Interface and Language (ACSIL) Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
To post a message in this thread, you need to log in with your Sierra Chart account: