coupster Posted June 16, 2020 Report Share Posted June 16, 2020 Hi guys, Can you help me with the following... I want to take the 13ema and the 34ema and strip the last 2 digits of the 4 digit decimal value. I want to be able to search for 2 averages that sit ontop of each other. Its hard to get a match with 4 decimals:) On another scan I would like to see a % difference between 13ema and 89ema. I would also like to have an option to set an alert on the % diff. I spent sometime last night reading every post on paintbar looking for examples. I'm not much of a programmer but can tinker with examples to make things work. Thanks for the help. Quote Link to comment Share on other sites More sharing options...
L W Posted June 16, 2020 Report Share Posted June 16, 2020 I know there is a Round method. Maybe that will help until Mike is around. https://docs.microsoft.com/en-us/dotnet/api/system.decimal.round?view=netcore-3.1 1 Quote Link to comment Share on other sites More sharing options...
coupster Posted June 16, 2020 Author Report Share Posted June 16, 2020 Thanks LW. Im not sure how to make it work. I'm going to spend some time over there to try and learn some basics. I used to play in metastock- they had a primer manual along with a huge collection of user contributed code. There was enough stuff available for me to hack stuff together. Last time I played with stuff was a decade ago. BTW thanks for your dragonfly code I came across that last night. I came across this SetScanResult(Sum(3, Close - Open).ToString("#,###.00##")); from one of the posts here, not sure if I can use the #,###.00 to strip away what I don't want. I think it was "prec" in metastock that did what Im looking to do. Quote Link to comment Share on other sites More sharing options...
coupster Posted June 16, 2020 Author Report Share Posted June 16, 2020 One more if not too much trouble. Would it be possible to make a rule that can actually plot the percentage away from the close? Say 50sma. Something I can look at on historic charts and see when things are way over done. thanks Quote Link to comment Share on other sites More sharing options...
Mike Medved Posted June 18, 2020 Report Share Posted June 18, 2020 If you're comparing two floating point values for equality, you definitely shouldn't just == them. You can do Math.Abs(A-B)<0.01 if you want to limit it that way. Easier than rounding them up and would take care of the case where one rounds up and the other rounds down. And yes you can do ONE plot per paintbar, for anything you want. That's the SetYValue function (in general, this page:https://www.medvedtrader.com/trader/WebHelp/advanced_-_all_available_funct.htm will probably be very helpful). So if the 50SMA is called SMA50 - you can just do these two lines: SetColor("% diff",Color.Lime); SetYValue(100*(SMA50-Close)/Close); You'd need to place this paintbar on the extra chart - either above or below the main one. And probably set the shape for the paintbar to size 1 so that the shapes do not obscure the line. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.