Jump to content
Medved Trader Forums

Mike Medved

Administrators
  • Posts

    1,537
  • Joined

  • Last visited

  • Days Won

    123

Posts posted by Mike Medved

  1. I will dedicate some time to this on Mon... If it's the case that the L1 feed of DXFeed produces candles with different volumes than the DXFeed backfill, will report it to them...

    As a reference, what kind of subscription bundle do you have with DXFeed?

  2. Ok so - are the volumes after 13:07 (that is, the volumes gathered from L1 data by MT) correct but backfill volumes aren't?

    If you clear data at that point and re-backfill will the volumes after 13:07 become a lot smaller?

  3. I would suggest looking at the Volume indicator on both charts (since VWAP is very sensitive to that). For example, TradingView: the volume is different from MT's volume, so the VWAP is not the same:

    image.png

  4. While optimizing the recalculation of new candles on dynamic updates of charts for OTHER chart types, I screwed up the recalc of the VbP candles.

    That was a while ago too :) You're the first one to notice it. Which means that not many people use them. Too bad - they are nifty.

    Fixed it. Jerry will put it up.

  5. Sure. Instead of PosPaid there, do this:

    Pos>0?PosPaid+0.02:PosPaid-0.02

    or it will also take

    IF Pos>0 THEN PosPaid+0.02 ELSE PosPaid-0.02

     

    inline conditionals are pretty handy. They can also be stacked - for example if you have no position, you want the price to be Bid? Then you do

    Pos>0?PosPaid+0.02:Pos<0?PosPaid-0.02:0

  6. Yes, that means it's running on 1-min candles, just like having a 1-minute chart and putting that paintbar on it.

    As for your question. No, the scan's indicator parameter is not # of minutes, but # of candles...

    You can twiddle this a bit. You can have two scans, running on two portfolios (with the same symbols in both portfolios). One scan you would run on 5-min candles, get the KC indicator and store the value in the SetInterVar function. This first scan would not trigger any scan result. In the other scan, you would use GetInterVar to receive that value, and use it as the KC value.

     

  7. On 1/8/2024 at 6:49 PM, 3acor said:

    the code wouldn't work. I would like to divide the volume by the difference between the current timestamp and the timestamp of the current 15min candle open.

    That's what (Timestamp.Minute % 15)+1  gives you. Stick this into a column in a scan and watch it go from 1 to 15 then roll over to 1... Just make sure the scan is run on 15 min candles.

  8. 18 hours ago, 3acor said:

    How can I get the difference between the current timestamp and the timestamp of the candle Open and use it in an equation?

    Example: I am using the scanner on the 15min frequency and currently the time is 10:41am. How can I get the difference of 11min which is the Current Timestamp minus the timestamp of the candle Open?

    (Timestamp.Minute % 15)+1 ?  1 for 1st minute. 2 for second minute. etc.

  9. For that you'd have to keep track of the average yourself. Use StateFIFOQueue of the appropriate size (period), zero it out whenever the new regular session starts (use TradingDay variable - the DayNumber in it changes when the new session starts, and you can figure out if you're in premarket or not as well) and add the candle's volume if regular session. Then take its average.

    • Like 1
  10. On 12/22/2023 at 5:09 AM, Thebattlefront said:

    Mike, So i understand that queue[3] = 2 should work now, but is it also possible to do queue[3]= queue[3] + 2? So I can make a cumulative sum inside only one of its cells.

    Also, can i do lets say,

    queue[5] = queue[4] / queue[2] or

    queue[5] = queue[4] * queue[2]

    Is division and multiplication allowed like that? And also, can i do math operations like

    queue[10] = Math.Round(queue[4] / queue[2], 2);

    Yes, all of those are possible.

  11. 3 hours ago, Thebattlefront said:

    Do you have any idea how I can change the value of a cell in a CurrentState array, by referencing itself and adding another value to it? Or do i have to switch back to individual currentstate variables and abandon the idea of keeping the data stored in a single array altogether?

    I remember before you showed me how to use the StateFIFOQueue to add data to a set, and then perform operations on that set (like getting the average) to get the important values i can use. So i know there are alternatives to using just a bunch of individual currentstate variables to hold the values. But I just don't know what those alternatives are.

    Yes for what you want (I think) it is best just to use StateFIFOQueue(20) for each of the arrays. You still have to manually save and restore state for each like you're already doing for the one StateFIFOQueue that you have. And you can only store Doubles of course...

  12. 3 hours ago, Thebattlefront said:

    Thanks Mike. Yeah i just want these arrays to store the data from the trades. Much like using individual currentstate variables and labelling them each CurrentState.m_dS1AtrPerBar, CurrentState.m_dS2AtrPerBar, CurrentState.m_dS3AtrPerBar, etc. but using just a single array for all to make it cleaner.

    Can i ask , what did you change? My results still look like this:

    Edit: The idea here is that each letter represents a different candlestick pattern. And what im doing is tracking the profit / number of trades / winrate of each candlestick, for each stock on my watchlist. That's what all the zeroes and the 1, 2, 3, 4, 5 numbers are in each column. They -should- be tracking the profit, tradecount, etc but i just get a bunch of zeroes.

     

     

    3f3c82b13fcd0aca4ef679788bff3844.png

    Look in the save and restore functions. Instead of copying just the structs, I specifically made it copy the arrays...

  13. Ok, I just realized something... I should mention it in help file.

    A struct that has arrays in it is a mutable struct. Which means that if you just do struct1=struct2, the arrays are not copied. They are there by reference, so both structs would be pointing to the same array.

    Let me figure out how to change your code the most elegantly so that this doesn't happen (and that the efficiency does not suffer).

     

  14. I haven't looked yet but here is a detail that may explain what you're seeing:

    MT's paintbars are a "state machine". There is a "state", and the new candle changes the "state". The thing is, this state-changing for the new candle may not be called only once per candle. It is for "past" candles, but for the new, latest candle, the "state" is restored to the condition right BEFORE the new candle - then the state-changing code is called for the new, latest candle. Hope this makes sense?

×
×
  • Create New...