Jump to content
Medved Trader Forums

Mike Medved

Administrators
  • Posts

    1,537
  • Joined

  • Last visited

  • Days Won

    123

Everything posted by Mike Medved

  1. When I send out the backfillAndGetCandles, I first receive these messages { "cmd": "backfill", "reqID": "1246", "success": "OK", "resultcode": 200, "result": { "action": "started", "type": "OHLC", "sym": "NVDA" } } ... and then { "cmd": "backfill", "reqID": "1246", "success": "OK", "resultcode": 200, "result": { "action": "finished", "type": "OHLC", "sym": "NVDA" } } ... and only after that, the { "cmd": "getCandles", "reqID": "1246", "success": "OK", ... etc. Is this not what happens for you?
  2. When you say maximum position size, you mean you don't want to add more to existing position if it is $10K?
  3. Hm ok it will have to be treated differently from every other indicator. I will look into that.
  4. If you open a historical chart for stock A, set VWAP to anchor at 1/1/2020 then close it. Then open a historical chart for stock B, set VWAP to anchor at 1/1/2021 then close it. Then re-open historical chart for stock A, the VWAP anchor will be remembered. But, if you switch charts by either typing a new symbol in the chart or by using linked symbols, the anchor date (or any other parameters for any other indicators) won't change.
  5. Ok - that OTA order that you have in the hotkey - is it executed? Because that red error box would indicate that it wasnt. I will try running the same thing here will look.
  6. Conditional orders, in secondary legs, cannot have absolute price values right now. They have to be relative to the main price. Let me investigate if that can be changed.
  7. Sure. Change if (TradingDay.IsPreMarket) to if (Timestamp < TradingDay.SessionStart.AddMinutes(-30))
  8. Ok I see why this is happening. The historical scanner assumes that you don't need more than 500 candles to work on. Apparently a bad assumption. I removed that. Well, made it bigger - 3000 candles. 3000 trading days back - hopefully that's more than anyone would need.
  9. .fctbNone{ color:#000000; } .fctbStyle4{ color:#0000ff; } .fctbStyle2{ color:#008000; } .fctbStyle3{ color:#000000; } .fctbStyle2Style3{ color:#000000; } .fctbStyle6{ color:#808080; }Note that everything *after* MainCalculation is just standard code inserted by MT when you make it a state machine. Also - to make it work right, it has to be run as an Intraday scan, with the extended hours set to Always. ==================================================================================================================== private struct PaintbarState { public Double PreMarketVolume; } int LastDayNumber = -1; FIFOQueue PreMarketVolumes = new FIFOQueue(5); // averaging on 5 days period Boolean WasPreMarket = false; public void MainCalculation() { SetDaysNeeded(5); // need 5 day's data for this to work if (TradingDay.DayNumber != LastDayNumber) // initialize to 0 start of every day { CurrentState.PreMarketVolume = 0; LastDayNumber = TradingDay.DayNumber; } if (TradingDay.IsPreMarket) { CurrentState.PreMarketVolume += BarVolume; WasPreMarket = true; } else { if (WasPreMarket) // add the premarket volume AFTER the premarket ends to the average queue { WasPreMarket = false; PreMarketVolumes.Add(CurrentState.PreMarketVolume); } } .fctbNone{ color:#000000; } .fctbStyle3{ color:#000000; } .fctbStyle1{ color:#800000; } SetScanResultColumnName(0, "Avg Premarket"); SetScanResult(0, Convert.ToInt64(PreMarketVolumes.Average)); } /// <summary> /// INITIALIZES paintbar. Is called at start of paintbar calculation, should be used to initialize anything needed for the paintbar /// NOTE: do NOT initialize the CurrentState here - the PaintbarClearState will be called AFTER this call, and will wipe it out. /// </summary> private void PaintbarInitialize() { } /// <summary> /// Holds current PB state - use to calc PB, changes to it carry over to next PB calc /// </summary> private PaintbarState CurrentState; /// <summary> /// Holds saved PB state - internal /// </summary> private PaintbarState SavedState; /// <summary> /// Is called at start of paintbar calculation, should be used to clear the paintbar state /// and initialize whatever variables you place into it. This is called AFTER PaintbarInitialize /// </summary> private void PaintbarClearState() { CurrentState = new PaintbarState(); } /// <summary> /// Saves paintbar state (called internally). /// </summary> private void PaintbarSaveState() { SavedState = CurrentState; } /// <summary> /// Restores paintbar state (called internally). /// </summary> private void PaintbarRestoreState() { CurrentState = SavedState; }
  10. Well yes That is what FIFO queues are about - to calculate averages for last N periods. Send me your scan and I will add that.
  11. 1. This is EXTREMELY inefficient. It has to loop through the last 1000 candles EVERY time there is a trade in the stock. I am surprised your MT didn't slow down to a crawl. 2. This says: if any of the last 1000 candles had a volume that was greater than 300M and went up more than 50% from low to high in ONE candle... Was there a candle in SPI that fit that criteria?
  12. Sorry. Of course I mean TradingDay.SessionEnd Timestamp >= TradingDay.SessionEnd.AddMinutes(1)
  13. Yes, scan results only show if the condition is true on the current - last - candle of the chart. Unlike the paintbar that can show if the condition was true on any candle in the chart. That's the whole point of the scanner - you can scan 3000 symbols and show only the tickers for which the condition is NOW true. You can, of course, write the scanner with a condition "if this condition was true in any of the last N candles", too.
  14. Thing is, 4pm candle (anything that is traded at or after 4pm) is considered afterhours. IsAfterHours in TradingDay is defined as Timestamp >= SessionEnd && Timestamp <= DayEnd So instead of IsAfterHours in your code, if you want to give a 1 min buffer you can just say Timestamp >= SessionEnd.SessionEnd.AddMinutes(1)
  15. Note that the alerts ONLY appear if they happen on the LAST (current) candle's calculation.
  16. I am not sure what the problem is. BarVolume is the volume of the current candle, even if it is not complete. If you show the results in paintbar, it should show in scan as well. The caveat here is that the initial conditions have to be the same between the two. That is, they both should be intraday or historical, both have the same extended hour setting, both have the same frequency.
  17. I tried and could not repeat. Please send us your setup - File / Help / Send Settings I will try using it to repeat the problem.
  18. Isn't that the same as ATR Trailing Stop in MT?
  19. Place a "Price Alerts" indicator on the chart. To make price alerts, use Alert Editor (from the Dashboard). Note that once you make a price alert and it shows as the indicator on the chart, you can drag it up/down to change it.
  20. I put that paintbar on NVCR and got nothing: Edit: apparently with some sources there is some gap-up data in extended hours on Wed, then the price goes down to 70s in the extended hours on Thursday. That would trigger the "gap down >10%" thing the PB is looking for. Bad data.
×
×
  • Create New...