You can not get intraday data from daily bars (as you have said the information 
is not there).

You need to work with intraday data base ... which will limit your data length 
of course.
  ----- Original Message ----- 
  From: irek_smaczny 
  To: [email protected] 
  Sent: Friday, February 22, 2008 7:14 AM
  Subject: [amibroker] Help - TimeFrameSet, Please


  Hi,
  I want to write simple system working on dayily bars. I want to take LONG 
when price = OPEN+15 or take SHORT when price = OPEN-15. But I have problem: 
how can I check on historical data what is first: OPEN+15 or OPEN-15. Days bar 
don't have this information and this is why in those specific days I want to 
change TimeFrame to 1minute bars or 1Hours bars. But I don't know how to do 
that :-(

  Could anybody help me with that ?

  Regards




  // set Automatic Analysis / Setting / Periodicity = Daily !!!!!!!!!!!!!
  SetBarsRequired(100000,100000); // require all past and all future bars
  SetOption("InitialEquity", 10000 );
  SetOption("MaxOpenPositions", 100 );
  SetTradeDelays(0,0,0,0);
  SetOption("FuturesMode", True);
  SetOption("ReverseSignalForcesExit", True);
  SetOption("AllowPositionShrinking", True);
  SetOption("AccountMargin", 100);
  SetOption("UsePrevBarEquityForPosSizing", False);
  SetOption("AllowSameBarExit", True); // aby by³o wiêcej niz jeden sygnal na 
swieczce !

  Buy = Sell = Cover = Short = 0;
  BuyPrice = SellPrice = CoverPrice = ShortPrice = 0;

  w1=15;

  for( i = 1; i < BarCount; i++ )
  {    
      if ((Open[i] + w1 <= High[i]) && (Open[i] - w1 >= Low[i]))
      {
          // HELP HELP HELP HELP HELP HELP HELP HELP HELP
          // HELP HELP HELP HELP HELP HELP HELP HELP HELP
          // HELP HELP HELP HELP HELP HELP HELP HELP HELP

          // long or short
          // how can I switch to 15 minut data and check what is first: long or 
short position on this day ?

          /*    
          TimeFrameSet (inHourly);
          HourOpen = Open;
          HourClose = Close;
          HourDateTime= DateTime();
          TimeFrameRestore ();

          HourOpen    = TimeFrameExpand( HourOpen , inDaily ); 
          HourClose     = TimeFrameExpand( HourClose , inDaily ); 
          HourDateTime    = TimeFrameExpand( HourDateTime, inDaily ); 
          for (number=1; number<5; number++) {
              _TRACE("# ,"+NumToStr(HourDateTime[number],formatDateTime)+" <aa> 
"+ii+", "+NumToStr(HourOpen[number],1.0,False)); 
          }
          */

      }
      else
      {
          if (Open[i] + w1 <= High[i]) {
              // now long position
              Buy[i] = True;
              BuyPrice[i]=Open[i] + w1;
              Sell[i] = True;
              rice[i]=Close[i];
          }
          if (Open[i] - w1 >= Low[i]) {
              // now Short position
              Short[i] = True;
              ShortPrice[i]=Open[i] - w1;
              Cover[i] = True;
              CoverPrice[i]=Open[i] - w1;            
          }
      }
  }
  Filter = ((BuyPrice > 0) || (ShortPrice > 0));
  AddColumn(BuyPrice, "BuyPrice", format=1.0);
  AddColumn(ShortPrice, "ShortPrice", format=1.0);

  GraphXSpace = 10;
  SetChartOptions(0,chartShowArrows|chartShowDates);

  _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, 
Close %g (%.1f%%) Vol " +WriteVal( V, 1.0 ) +" {{VALUES}}", O, H, L, C, 
SelectedValue( ROC( C, 1 )) ));
  _N(Title = Title + EncodeColor(colorRed));

  Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | 
ParamStyle("Style") | GetPriceStyle() ); 
  PlotShapes(Buy*shapeUpArrow,colorGreen,0,Low);
  PlotShapes(Short*shapeDownArrow, colorRed, 0, High);
  PlotShapes(Sell*shapeHollowDownArrow,colorGreen,0,High +12);
  PlotShapes(Cover*shapeHollowUpArrow, colorRed, 0, Low -12);
   

Reply via email to