Announcement

Collapse
No announcement yet.

Multiple Time Frames

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

  • Multiple Time Frames

    Attachment: candlestick indicator.efs

    Was written to place a candlestick chart in the study pane.

    Is it possible to set the time interval of the candles tick chart or can it only default to the interval of the price pane.

    I tried adding inv(5) in the

    xOpen = open(sym(Symbol, inv(5) ));//etc

    to no avail

    See http://forum.esignalcentral.com/show...dlestick+study

  • #2
    David
    The correct syntax is open(sym(Symbol+","+5));
    Regardless the efs would need some other changes to do what you want.
    Alex

    Comment


    • #3
      //This will draw 5 minute bars on a 1 minute chart, just a start...
      // please, no cringing

      /************************************************** *******
      Alexis C. Montenegro © October 2005
      Use and/or modify this code freely. If you redistribute it
      please include this and/or any other comment blocks and a
      description of any changes you make.
      ************************************************** ********/

      function preMain() {

      setPriceStudy(false);
      setStudyTitle("Symbol");
      setCursorLabelName("Open", 0);
      setCursorLabelName("High", 1);
      setCursorLabelName("Low", 2);
      setCursorLabelName("Close", 3);
      setDefaultBarFgColor(Color.black, 0);
      setDefaultBarFgColor(Color.black, 1);
      setDefaultBarFgColor(Color.black, 2);
      setDefaultBarFgColor(Color.black, 3);
      setPlotType(PLOTTYPE_DOT, 0);
      setPlotType(PLOTTYPE_DOT, 1);
      setPlotType(PLOTTYPE_DOT, 2);
      setPlotType(PLOTTYPE_FLATLINES, 3);
      setDefaultBarThickness(0, 0);
      setDefaultBarThickness(0, 1);
      setDefaultBarThickness(0, 2);
      setDefaultBarThickness(0, 3);
      askForInput();

      var fp1 = new FunctionParameter("Symbol", FunctionParameter.STRING);
      fp1.setDefault();

      var fp2 = new FunctionParameter("Wick", FunctionParameter.COLOR);
      fp2.setDefault(Color.black);

      var fp3 = new FunctionParameter("Bars", FunctionParameter.NUMBER);
      fp3.setDefault(200);
      }

      var bInit = false;
      var xOpen = null;
      var xHigh = null;
      var xLow = null;
      var xClose = null;
      var iCntr = 0;
      var vColor = Color.black;

      function main(Symbol,Wick,Bars) {

      //if(bInit==false){//djloomis had to remove this
      if(Symbol==null) Symbol = getSymbol();
      xOpen = open(sym(Symbol+","+ 5));//DJLoomis set inv to 5
      xHigh = high(sym(Symbol+","+ 5));
      xLow = low(sym(Symbol+","+ 5));
      xClose = close(sym(Symbol+","+ 5));
      bInit = true;
      //}//djloomis had to remove this

      if (getBarState()==BARSTATE_NEWBAR) {
      iCntr++;
      if (iCntr>Bars) iCntr = 0;
      }

      var nOpen = xOpen//.getValue(0);//djloomis asjusted for efs2
      var nHigh = xHigh//.getValue(0);
      var nLow = xLow//.getValue(0);
      var nClose = xClose//.getValue(0);

      if(nHigh==null||nLow==null||nOpen==null||nClose==n ull) return;

      if(nClose>nOpen) vColor=Color.RGB(0,190,0);
      else if(nClose<nOpen) vColor=Color.red;
      else vColor=Color.grey;

      //debugPrintln((getMinute(0)/5)%1)
      if((getMinute(0)/5)%1>=0.75){//djl checks for the end of the 5 min bar
      drawLineRelative(0, nHigh, 0, nLow, PS_SOLID, 1, Wick, "Shadow"+iCntr);
      drawLineRelative(0, nOpen, 0, nClose, PS_SOLID, 1, vColor, "Body"+iCntr);
      setBarBgColor(vColor,0,nOpen,nClose);
      setBarFgColor(vColor,3)}
      return new Array (nOpen+"", nHigh+"", nLow+"", nClose+""); //djl doesnt plot the hloc, just report it
      return ;
      }

      Comment


      • #4
        David
        You need to return a series to the chart else there are no reference points for the graphic objects.
        In the return statement try replacing nClose+"" with nClose and setting the plot type to _DOT
        Alex

        Comment

        Working...
        X