Announcement

Collapse
No announcement yet.

New to EFS

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

  • New to EFS

    Hi!

    I'm a fairly new user of ESignal and wondered if one of my ELA-codes (Tradestation) could be transferred to be used in ESignal.

    Michael from the ESignal-Support asked me to post my question here.

    Any help would be great!

    Thanks a lot,
    Harry

    The study colors bars on a bar chart.

    This is the ELA-Code:

    {Name: ATRLngShrt
    Notes: Paints bars based on the change of price from the lowest low or highest high
    of a given period with the addition of the Average True Range

    Input: BarLength - Number of bars to calculate lowest low or highest high (16 is the default value)
    ATRLength - Number of days to calculate the ATR and the SMA of the ATR
    }

    Input: BarLength(16), ATRLength(9);
    Vars: LowestLow(0), HighestHigh(0);

    If CurrentBar > 1 Then Begin

    LowestLow = Lowest (low, BarLength);
    HighestHigh = Highest (High, BarLength);


    If Close > LowestLow + AverageFC(AvgTrueRange(ATRLength), ATRLength) * 2.5 AND
    Close > HighestHigh - AverageFC( AvgTrueRange(ATRLength), ATRLength) * 2.5 then begin

    PlotPaintBar(High, Low, Open, Close, "LongShort", Green);

    End;

    If Close < HighestHigh - AverageFC( AvgTrueRange(ATRLength), ATRLength) * 2.5 AND
    Close < LowestLow + AverageFC(AvgTrueRange(ATRLength), ATRLength) * 2.5 then begin

    PlotPaintBar (High, Low, Open, Close, "LongShort", Red);

    End;

    End;

  • #2
    Here's what I have so far, though I'm not sure why the price bars aren't changing color. Anyone know?

    PHP Code:
    /************************
    Copyright © eSignal, 2003
    *************************
    Description: Paints bars based on the change of price from the lowest low or highest high 
    of a given period with the addition of the Average True Range 
    */

    var vATRStudy null;


    function 
    preMain() {
        
    setStudyTitle("ATRLngShrt");
        
    setCursorLabelName("ATRLngShort");
        
    setColorPriceBars(true);
        
    setDefaultPriceBarColor(Color.black);
    }

    function 
    main(nBarLength,nATRLength) {

        if (
    nBarLength == nullnBarLength 16// sets default
        
    if (nATRLength == nullnATRLength 9// sets default
        
        // Establish object with Built-in ATR
        
    if (vATRStudy == nullvATRStudy = new ATRStudy(nATRLength);
        
        
    // get Lowest Low
        
    var LL null;
        var 
    vLowArray low(0,-nBarLength);
        
        for (
    i=0nBarLengthi++) {
            
    LL Math.min (vLowArray[i], vLowArray[i+1]);
        }
        
        
    // get Highest High
        
    var HH null;
        var 
    vHighArray high(0,-nBarLength);
        
        for (
    i=0nBarLengthi++) {
            
    HH Math.max (vHighArray[i], vHighArray[i+1]);
        }
        
        var 
    vClose close();
        var 
    vATR vATRStudy.getValue(ATRStudy.ATR)
        
        if (
    vClose LL + ((vATR nATRLength)/2) * 2.5 &&
            
    vClose HH - ((vATR nATRLength)/2) * 2.5) {
            
            
    setPriceBarColor(Color.green);
        }
        
        if (
    vClose LL + ((vATR nATRLength)/2) * 2.5 &&
            
    vClose HH - ((vATR nATRLength)/2) * 2.5) {
            
            
    setPriceBarColor(Color.red);
        }
        
        return 
    vATR;

    Attached Files
    Regards,
    Jay F.
    Product Manager
    _____________________________________
    Have a suggestion to improve our products?
    Click Support --> Request a Feature in eSignal 11

    Comment


    • #3
      Jay
      Have you tried plotting
      LL + ((vATR + nATRLength)/2) * 2.5
      HH - ((vATR + nATRLength)/2) * 2.5
      to see where they are respect to prices. It could be that the conditions are actually never met.
      Just an idea
      Alex

      Comment

      Working...
      X