Register Login
Forums    February 9, 2012
TradersStudio Forums
How to pass system info to indicator plot?
Last Post 04-21-2008 04:37 AM by mur ang. 1 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Thomas Stridsman
New Member
New Member
Posts:9

--
04-21-2008 04:27 AM
    I would like for my custom indicator in the charts within a session to adjust to the direction of the current open position of the system.
    Something along these lines:

    If GetMarketPos(0) = +1 Then
        Risk1A = Min(Risk1, Risk1 * AdjustRisk)
    Else
    If GetMarketPos(0) = -1 Then
        Risk1A = Max(Risk1, Risk1 * AdjustRisk)
    Else
        Risk1A = Risk1
    End If
    End If
    Plot1(p0 + Risk1A / ContVal)

    In this case, although the GetMarketPos(0) function verifies correctly inside the custom indicator plot, it doesn't seem to recognize any open positions in the corresponding system attached to the same session. Same goes for GetCurrentPosition and GetCurrentSize.

    It seems it should be doable to pass system info to a custom indicator plot as there already is a built-in chart equity line function. But how?
    mur ang
    Advanced Member
    Advanced Member
    Posts:525

    --
    04-21-2008 04:37 AM

    The system based functions will not work from indicators. You need to use the Processor API based functions. You can use the market object by using the  thismarket object.

     

    ' TradersStudio(r) (c) 2005-2007
    ' Shows how to access Market object from a session
    ' It uses Thismarket
    Sub TS_PlotDrawdown()
    Plot1(Thismarket.Equity(BarNumber).Drawdown)
    End Sub

    You are not authorized to post a reply.


     TradersStudio, Inc. ® Copyright 2004-2012 All Rights Reserved   Terms Of Use  Privacy Statement