Jump to content
Medved Trader Forums

All Activity

This stream auto-updates     

  1. Today
  2. You're right, I forgot the public part. And setting it to 999999 would be in PaintbarClearState - but it only affects the candles from the beginning of the chart to the first occurrence of your condition - basically if you don't set it that way, it will assume that the candle right before the beginning of the chart satisfied the condition. As you can see, having C# available to program paintbars/scans is very versatile. Hope the help file clarified things.
  3. I was getting an "inaccessible due to it's protection level" error, so I put "public" in front of "int Boom;" and it worked. You suggested setting the state variable to 99999, which I'm not sure where to put, but it seems to work anyway. Thanks again. I posted the full code of my original example idea in case it helps anyone. private void PaintbarInitialize() { } private struct PaintbarState { public int OutsideBar; public int InsideBar; } private PaintbarState CurrentState; private PaintbarState SavedState; private void PaintbarClearState() { CurrentState = new PaintbarState(); } private void PaintbarSaveState() { SavedState = CurrentState; } private void PaintbarRestoreState() { CurrentState = SavedState; } public void MainCalculation() { if (High>High[1] && Low < Low[1]) { CurrentState.OutsideBar = 0; } else { CurrentState.OutsideBar++; } if (High<High[1] && Low > Low[1]) { CurrentState.InsideBar = 0; } else { CurrentState.InsideBar++; } if (CurrentState.OutsideBar < CurrentState.InsideBar) { SetColor(Color.Green); } }
  4. There is an option in the ribbon menu to add State to the indicator. That adds a bunch of code, including the CurrentState and a few state-initializing, saving and restoring functions. You put the Boom into the PaintbarState definition: .fctbNone{ color:#000000; } .fctbStyle8{ color:#808080; } .fctbStyle2{ color:#008000; } .fctbStyle5{ color:#0000ff; }/// <summary> /// Holds paintbar state - fill with variables needed to be preserved for next paintbar calc /// </summary> private struct PaintbarState { int Boom; // <--- this is what you add } see https://www.medvedtrader.com/trader/WebHelp/state_keeping.htm I really worked on that help file to make it as comprehensive as possible
  5. Thanks Mike for the tip. I put together most of it, but I'm not quite sure how to declare a state variable called Boom. I googled but didn't find any good examples. What I have is below: public void MainCalculation() { //declare state variable Boom; if (High>High[1] && Low < Low[1]) { CurrentState.Boom = 0; } else { CurrentState.Boom++; } if (CurrentState.Boom > 5) { SetColor(Color.Green); } }
  6. Well, the way to do this would be - have a state variable, let's call it Boom (as in "something happened"). Set it to 9999999 or something to begin with. Any time an event happens (like "Outside bar (engulfing)") - set CurrentState.Boom to 0. If the event did NOT happen, do CurrentState.Boom++ This way you can check the CurrentState.Boom to see how far back the event happened.
  7. Hey guys, Recently I inquired about the possibility of a "Bars Since True" looping function, where it reports the # of bars since a particular chart event, which I guess would be a timespan data type. In case it wasn't on the todo list, I figured I would ask if there is a way to do it without the simplified looping function? I have snippets from other loops, and in a previous thread the "Ago" was mentioned, but I can't seem to put it together. One use would be to compare the recency of particular chart events, for example: If Bars since "Outside bar (engulfing)" > Bars since "Inside bar" { SetColor(Color.Green); }
  8. The drawing tool will always revert to the default. The default is set in SETTINGS/ CHARTS / GENERAL
  9. I would like for the alert line option to always be set whenever I open my layout. What I've found is that even if I set it to use alert line and then save the layout it reverts back to the simple line drawing tool in the QAT the next time I open the layout. Is this normal behavior? If so, is there another option somewhere to make the alert line the default? If so, I haven't been able to find it. Thanks!
  10. Yesterday
  11. Why should I notice that , my futures symbols all have the 19 right there on the same port 😤 Thanks
  12. Have to use MT symbol format 19 instead of 9
  13. @BTCM9 the IB symbol, not bring up quotes
  14. add columns short date and short time columns i.e 26th and 8.13am full date is too wide
  15. Last week
  16. Yes. Please download and install the beta version. It will fix the issue
  17. Have you been able to confirm there is an issue with this?
  18. Downloaded the Beta version and the E*Trade data source now works except I now get this "Missing MF.dll..." error message when I initiate MT. Any thoughts on this? Downloaded the Beta version and the E*Trade data source now works except I now get this "Missing MF.dll..." error message when I initiate MT. Any thoughts on this?
  19. Would it be possible to make it so that if you double click on an alert line it goes to the edit alert window. Currently if you double click on the alert line the chart window maximizes or goes back to window mode.
  20. yes, 3 times 10 candle average, unless you specify a different amount for RangeAveragePeriod
  21. Great, thanks! Am I correct then to conclude from this that the function is already requiring the candle body to be at least 3 times the size of the average candle range across the period? I wouldn't have thought it to be so demanding just from seeing it at work in charts.
  22. that is a bit specific. What I can do to solve your problem is just give you the function for StrongLine - you can then put it into your Paintbar after the MainCalculation function, and then modify it however you want: .fctbNone{ color:#000000; } .fctbStyle5{ color:#0000ff; } .fctbStyle7{ color:#000000; } public Boolean StrongLine(int Ago = 0, int RangeAveragePeriod = 10) { Double RangeAverage = CandlePattern.AverageCandleBody(RangeAveragePeriod); double body = CandlePattern.CandleBody(Ago); if (body >= RangeAverage * 3 && CandlePattern.BottomWick(Ago) <= body && CandlePattern.TopWick(Ago) <= body) { return true; } return false; } You can just copy/paste the above code in its entirety at the end of your paintbar and reference "Strongline" instead of CandlePattern.Strongline in your regular script code
  23. Here is the code: public void MainCalculation() { if (Close.CrossesUp(PP_R1, 0)) { SetColorAndShape("Crossover", PBShape.Fill, SysColor.Positive); } if (Close.CrossesDown(PP_S1, 0)) { SetColorAndShape("Crossover", PBShape.Fill, SysColor.MainIndicator3); } }
  24. I am trying to create a paintbar that will highlight a candle that crosses over a pivot point level. This is the code I have: My intent is for only the candle that is overlapping the PP level to be identified. What seems to be happening is that once a candle has closed over (or above) the R1 level many (but not all) candles that close above it will also be highlighted. And vice versa after the close of the first candle below the S1. This is happening without much rhyme or reason regardless of whether or not the PP level was ever within the candle's range. I've tried experimenting with CurrentCandle without finding any traction on this.
  25. Not sure if this would be a feature request or if this achievable currently without my awareness but I would like to ask if it's possible to add a criteria to one of the candle stick patterns available in the paintbars. I wish to use the "StrongLine" pattern. Currently I can set the RangeAveragePeriod for the detection and as I understand it the pattern is matched when the candle's range becomes larger than this RangeAveragePeriod. What I would like is to be able to set a threshold for the match such that a match is not returned unless the candle range exceeds a percentage or multiple of that RangeAveragePeriod. For example, only if the candle is 2 times the length of the RangeAveragePeriod or 150% of the RangeAveragePeriod would an alert be issued. This would provide us with a huge degree of flexibility in avoiding false positives.
  26. Would really like to see this functionality added natively as a part of the program at some point in the future. But I think I can achieve this with automation software I'm using for other purposes anyway.
  1. Load more activity
×
×
  • Create New...