Jump to content
Medved Trader Forums

jasper

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by jasper

  1. So i'm much better coding in nodeJS, and am wondering if i can have medved perform a localhost server request or database request or some other location i deposit market data? for example if the scan performs a get request to localhost:8080?TSQ (a nodeJS server) and have returned some JSON or XML data that can be used within the scanner/paintbar? I was also curious if an intraday scan could perform a request to medved's built-in API to retrieve daily data within an intraday scan?

  2. Mike, thanks for your help. I really like your if statement to find the first bar of the day. 

    When I use the FIFOQueue I don't get any results on the scanner or in my charts. Here is what I just tried:

    FIFOQueue Qvwap; FIFOQueue SQvwap;
    private void PaintbarInitialize(){}
    private struct PaintbarState{public DateTime SessionStart;}
    private PaintbarState CurrentState;
    private PaintbarState SavedState;
    private void PaintbarClearState()
    {
        CurrentState     = new PaintbarState();  
        FIFOQueue Qvwap  = new FIFOQueue(100);
        FIFOQueue SQvwap = new FIFOQueue(100);
    }
    private void PaintbarSaveState()
    {
        SavedState = CurrentState;
        Qvwap.CopyTo(SQvwap); 
    }
    private void PaintbarRestoreState()
    {
        CurrentState = SavedState;
        SQvwap.CopyTo(Qvwap);
    }
    public void MainCalculation(){
        var session = GetTradingSessionInfo(Timestamp);
        
        if (CurrentState.SessionStart != session.SessionStart){
            CurrentState.SessionStart = session.SessionStart;
            Qvwap.Add(vwap[1]);
        }
        
        SetColorAndShape("Line", PBShape.Rectangle, SysColor.MainIndicator2);
        SetYValue(Qvwap.Last);
        SetScanResult(Qvwap[4]+", "+Qvwap.First);

  3. I am trying to code an indicator that paints the end of day vwap from the previous day as a line for the current day (on a 5 minute chart). I have managed to plot this on my chart, but cannot seem to carry forward the historical values for these lines. for example, it would be nice to have a FIFO Q(20) with the last 20 horizontal line values. Attached you should find an image of a chart with this paintbar.

    
    private void PaintbarInitialize(){}
    private struct PaintbarState{public double today;}
    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(){
    
        var session = GetTradingSessionInfo(Timestamp);
        if (Timestamp == session.SessionStart){
            if (vwap[1] > .01 ) {CurrentState.today = vwap[1];}
            else if (vwap[2] > .01 ) {CurrentState.today = vwap[2];}
            else if (vwap[3] > .01 ) {CurrentState.today = vwap[3];}
            else if (vwap[4] > .01 ) {CurrentState.today = vwap[4];}
            else if (vwap[5] > .01 ) {CurrentState.today = vwap[5];}
            else if (vwap[6] > .01 ) {CurrentState.today = vwap[6];}
        }
    
        SetColorAndShape("Line", PBShape.Rectangle, SysColor.MainIndicator2);
        SetYValue(CurrentState.today);
        SetScanResult(CurrentState.today);
    
    }
    

     

    steps.jpg

×
×
  • Create New...