Jump to content
Medved Trader Forums

Mike Medved

Administrators
  • Posts

    1,543
  • Joined

  • Last visited

  • Days Won

    124

Posts posted by Mike Medved

  1. The formula for EMA is simple:

    1. Mult = 2/(1+period)

    2. EMA = PrevEMA+Mult*(Value-PrevEMA)

     

    So - take a set of data. Let's say 1000 points. And do EMA using the last 20, then last 40, then last 60 etc. And compare the values :) You can even do that in excel...

  2. If you wanted to go back a long way on a scan, you can use the SetDaysNeeded function. We try not to overdo that so that the initial backfills on scans don't take a really long time.

  3. Are you asking about charts? It goes back to the beginning of the chart.

     

    Are you asking about paintbars? For intraday, usually to the beginning of the day, unless some indicator in the paintbar requires more or you specify more by calling the SetDaysNeeded function.

  4. In general, looping in scans/paintbars is not an efficient method...

    You have to remember, the code in scan/paintbar is executed for each candle to start with, and then for each update subsequently. The paintbar is a state machine.

    So all the stuff that you do with loops can be done by, for example for your loops, keeping a counter that is increased each time the condition is met, zeroing it each time the position is not met. Have to do that with "State-keeping" code, with the counter inside the state.

  5. 1. No, intervars don't stream. You have to get it every time you want an updated value. It is very light in terms of processing, so poll it as much as you want. Make sure you figure out what intervar you want - a symbol-specific one or a "global" one.

    2. No need to throttle scans. You run the scan, it initializes (possibly slowly if there are a lot of backfills) then just runs on every update. Again, unless it is written really inefficiently (like huge loops for each run) it is pretty light, so no need to just run it every X minutes. But - if you really would like to, there is code that you can put in the scan that will only run once the candle is finished.  Just check the IsNewCandle variable, and if true, run the calculations on the previous candle (which at that point would be finished).
     

     

  6. The hotkey actually places the order. If it is a "send" it sends the order to the broker. If it is not a "send" but just a "drop" it drops the capsule on the chart. But it is a "do and forget" thing. If you send or drop another order, it will not replace the previous one, it will add one more...

    There is a ChangeOrder hotkey that could work, but you would still to hit the hotkey to do that and it works under certain circumstances only. Like on Chart it would change the order over which the mouse is, or if there is only one order, will change that one.

     

  7. You're doing this in a scan, you have the SymbolData.Symbol string variable available.  Just check for

    SymbolData.Symbol.StartsWith(".SPY") or something.

    Like, if you don't want your scan to run on ANY option symbol, just put this at the very start of the scan

        if (SymbolData.Symbol.StartsWith(".SPY"))
           return;

     

     

  8. Means the data you see comes from an OHLC backfill (not from a running feed or from a tick backfill).

    OHLC backfill in MT means - MT received one minute OHLC data and split it into 4 pseudo-ticks, - O H L and C spread across that minute's time period.

  9. 2 minutes ago, Np2112 said:

    Yes, I had tried doing that with Fidelity earlier, but sometimes the stop order would get executed before, while the trim order was still waiting to be filled, this creates error stop qnty would be more than position held. Hence was looking at OTA orders. 

    Right. Try a Delay inbetween.

  10. 3 minutes ago, Np2112 said:

    Thanks Mike, is there is a workaround for what i am trying to do then inside of 1 hotkey?

    worst case, i can just not use a conditional order and use 2 keystokes to execute, 1st to trim and 2nd to move pos to b/e.  

     

    You can execute two or more orders in one hotkey... Each one independent of the other?

  11. First, you have an OTA order with 2 different quantities in the legs. I am pretty sure we don't allow for it.

    Second - your "triggered" order has Pos as the quantity. You probably think that the Pos includes the amount that was bought on the first leg. But the Pos is taken from the account positions *at the time* of the hotkey execution.

×
×
  • Create New...