gariki,

have a look at the code below. Maybe it will give you some ideas,

rgds, Ed


waitPeriod = 20; 
triggerPercentage = 0.05; 
setupPeriod = 50; 

SetupLong = ExRemSpan(C < BBandBot(C, setupPeriod, 2), waitPeriod); 
SetupPriceLong = ValueWhen(SetupLong,L) - ValueWhen(SetupLong,L) * 
triggerPercentage; 

Buy = Cross(SetupPriceLong,L) && BarsSince(SetupLong) < waitPeriod; 
BuyPrice = SetupPriceLong; 

SetupShort = ExRemSpan(C > BBandTop(C, setupPeriod, 2), waitPeriod); 
SetupPriceShort = ValueWhen(SetupShort,H) + ValueWhen(SetupShort,H) * 
triggerPercentage; 

Short = Cross(H,SetupPriceShort) && BarsSince(SetupShort) < waitPeriod; 
ShortPrice = SetupPriceShort; 

SetChartOptions(0, chartShowDates); 
GraphXSpace = 5; 
Plot(C,"C",1,64); 
Plot(BBandBot(C,20,2),"",colorGold,1); 
Plot(BBandTop(C,20,2),"",colorGold,1); 

Plot(IIf(BarsSince(setuplong) < 
waitPeriod,SetupPriceLong,Null),"",colorLightBlue,1); 
Plot(IIf(BarsSince(setupShort) < 
waitPeriod,SetupPriceShort,Null),"",colorLightOrange,1); 

PlotShapes(IIf(SetupLong,shapeSmallCircle,0),colorYellow,0,L,-5); 
PlotShapes(IIf(SetupLong,shapeHollowCircle,0),colorWhite,0,L,-5); 
PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorGreen,0,L,-15); 
PlotShapes(IIf(Buy,shapeHollowUpArrow,shapeNone),colorWhite,0,L,-15); 
PlotShapes(IIf(Buy,shapeHollowSmallCircle,shapeNone),colorWhite,0,BuyPrice,0); 

PlotShapes(IIf(SetupShort,shapeSmallCircle,0),colorYellow,0,H,-5); 
PlotShapes(IIf(SetupShort,shapeHollowCircle,0),colorWhite,0,H,-5); 
PlotShapes(IIf(Short,shapeDownTriangle,shapeNone),colorYellow,0,H,-15); 
PlotShapes(IIf(Short,shapeHollowDownTriangle,shapeNone),colorWhite,0,H,-15); 
PlotShapes(IIf(Short,shapeHollowCircle,shapeNone),colorWhite,0,ShortPrice,0); 







  ----- Original Message ----- 
  From: Chaitanya 
  To: [email protected] 
  Sent: Friday, September 25, 2009 5:19 PM
  Subject: [amibroker] Want to get filled say 1% higher than the price at 
signal.


    Hello all,

  Is there an easy way to test if i want to wait for a slightly better price 
(say 1%) than the standard buy signal (bake it into the buy signal) but 
ofcourse entry valid only until i get the standard sell signal.

  Example: Say i got a long entry into X at 25.00 using a system and exit at 
say 27.00. And say it took 15days for the trade. To test what i want, i need to 
go through all bars between my entry and exit and see if the high of any of 
them went above 25.25. How do i do this easily? 

  Thanks
  -gariki



  

Reply via email to