Announcement

Collapse
No announcement yet.

Retrieving XTL color

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Retrieving XTL color

    Hi

    I m creating some strategies that include the XTL also.

    How can I retreive the XTL color - for example
    is there a command that will get the color of the current live bar so I can then use it in my strategy ?

    Thanks a lot

    Noam

    p.s

    same question for color and relative position of the JTI

  • #2
    Noam,

    If you are a subscriber of the Advanced GET studies, you can use this formula as a base for accessing the XTL stuff.

    It's been a while since I ran this so I'm not sure if it still works. I think there were some bugs with the fib calculations being done... It does demonstrate how to access the XTL study and there are constants for the return values.

    PHP Code:
    function preMain() {
        
    setStudyTitle("Auto XTL");
        
    setPriceStudy(true);
    }

    var 
    xtl = new GetXTLStudy(35);

    var 
    XTL_DOWN    0
    var XTL_UP    1
    var XTL_NEUTRAL    2

    var vLastXTL null;

    function 
    main() {
        var 
    nState getBarState();
        if(
    nState == BARSTATE_CURRENTBAR)
            return;

        
    // Syntax is getValue(GetXTLStudy.XTL, 0, -xxx);        
        
    var vXTL xtl.getValue(0);
        
        if(
    vXTL == null)
            return;

        if(
    vLastXTL != null) {
            if(
    vLastXTL == XTL_DOWN  && vXTL != XTL_DOWN) {
                var 
    vH high(-1);
                var 
    vL low(-1);
                
                if(
    vH == null || vL == null)
                    return;
                    
                var 
    vHL50 = (vH vL) * 0.5;
                var 
    vEntry vL vHL50;
                var 
    vExit vH vHL50;
                var 
    vStop vEntry - (vExit vEntry) * 1.618;
                

                
    addLineTool(LineTool.SEGMENTgetCurrentBarIndex()-1vHgetCurrentBarIndex() + 5vH2Color.black"tag");
                
    addLineTool(LineTool.SEGMENTgetCurrentBarIndex()-1vLgetCurrentBarIndex() + 5vL2Color.black"tag");

                
    addLineTool(LineTool.SEGMENTgetCurrentBarIndex()-1vEntrygetCurrentBarIndex() + 5vEntry2Color.red"tag");
                
    addLineTool(LineTool.SEGMENTgetCurrentBarIndex()-1vExitgetCurrentBarIndex() + 5vExit2Color.red"tag");
                
    addLineTool(LineTool.SEGMENTgetCurrentBarIndex()-1vStopgetCurrentBarIndex() + 5vStop2Color.red"tag");
                
    addLineTool(LineTool.SEGMENTgetCurrentBarIndex()-1vStopgetCurrentBarIndex()-1vExit1Color.yellow"tag");

                
    drawTextRelative(-1vEntry"Short@ " vEntry
                    
    Color.rednull,
                    
    Text.BOTTOM Text.RIGHT Text.ONTOP Text.BOLD
                    
    nullnull"BuyEntry" getValue("rawtime"));

                
    drawTextRelative(-1vExit"Cover@ " vExit
                    
    Color.rednull,
                    
    Text.BOTTOM Text.RIGHT Text.ONTOP Text.BOLD
                    
    nullnull"SellEntry" getValue("rawtime"));

                
    drawTextRelative(-1vStop"Stop@ " vStop
                    
    Color.rednull,
                    
    Text.BOTTOM Text.RIGHT Text.ONTOP Text.BOLD
                    
    nullnull"StopEntry" getValue("rawtime"));



            } else if(
    vLastXTL == XTL_UP && vXTL != XTL_UP) {
                var 
    vH high(-1);
                var 
    vL low(-1);
                
                if(
    vH == null || vL == null)
                    return;
                    
                var 
    vHL50 = (vH vL) * 0.5;
                var 
    vEntry vH vHL50;
                var 
    vExit vL vHL50;
                var 
    vStop vEntry + (vEntry vExit) * 1.618;
                

                
    addLineTool(LineTool.SEGMENTgetCurrentBarIndex()-1vHgetCurrentBarIndex() + 5vH2Color.black"tag");
                
    addLineTool(LineTool.SEGMENTgetCurrentBarIndex()-1vLgetCurrentBarIndex() + 5vL2Color.black"tag");

                
    addLineTool(LineTool.SEGMENTgetCurrentBarIndex()-1vEntrygetCurrentBarIndex() + 5vEntry2Color.blue"tag");
                
    addLineTool(LineTool.SEGMENTgetCurrentBarIndex()-1vExitgetCurrentBarIndex() + 5vExit2Color.blue"tag");
                
    addLineTool(LineTool.SEGMENTgetCurrentBarIndex()-1vStopgetCurrentBarIndex() + 5vStop2Color.blue"tag");
                
    addLineTool(LineTool.SEGMENTgetCurrentBarIndex()-1vStopgetCurrentBarIndex()-1vExit1Color.yellow"tag");

                
    drawTextRelative(-1vEntry"Buy@ " vEntry
                    
    Color.bluenull,
                    
    Text.BOTTOM Text.RIGHT Text.ONTOP Text.BOLD
                    
    nullnull"BuyEntry" getValue("rawtime"));

                
    drawTextRelative(-1vExit"Sell@ " vExit
                    
    Color.bluenull,
                    
    Text.BOTTOM Text.RIGHT Text.ONTOP Text.BOLD
                    
    nullnull"SellEntry" getValue("rawtime"));

                
    drawTextRelative(-1vStop"Stop@ " vStop
                    
    Color.bluenull,
                    
    Text.BOTTOM Text.RIGHT Text.ONTOP Text.BOLD
                    
    nullnull"StopEntry" getValue("rawtime"));




                    
            
            }
        }

        
    vLastXTL vXTL;

    Matt Gundersen

    Comment

    Working...
    X