[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: formula trouble



PureBytes Links

Trading Reference Links

The Out position is used with sell respect. cover to make certain 
one is not onvernight in the market. You can alter this to your 
needs.
The sethour position is included to make certain trades are only 
entertained during defined trading hours. So in your case this line 
should do the trick:
sethour=TimeNum()>093000 AND TimeNum()<160000;
To achieve proper functioning you may have to put under 
Databasesettings->basetime interval: 1 min.
Also the corresponding chart is on 1 min bars.

Hope this sorts your problem out.

Willem Jan

--- In amibroker@xxxxxxxxxxxxxxx, "me_rayme" <rayme@xxxx> wrote:
> Formula works better and is reasonible,now I get up and down 
arrows 
> on YM or ER2 one minute but having problem with the 
sethour=Timenum 
> routine.
> 
> I still get arrows before 090000, have changed this to 093000, NY 
> time 9:30am, still bad.
> 
> I only want arrows between 9:30 and 16:00  when the volume is best.
> 
> When I backtest I also want the NY hours when the volume is larger.
> 
> I have played around with this time routine  but cant find a 
> solution.
> 
> Ray
> 
> 
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "willem1940" 
<w.j.a.struyck@xxxx> 
> wrote:
> > This is what I made of the formula. It works. Results for DAX 
> future 
> > on walk forward basis not very impressive. Optimization and 
> > Walkforward carried out with Fred's IO system.
> > Hope it contirbutes.
> > 
> > //io:fitness:netprof
> > //io:StatusWindow:n
> > 
> > //Tradesettings
> > SetTradeDelays(1,1,1,1);                    
> > BuyPrice = Open;
> > SellPrice = Open;
> > ShortPrice = Open;
> > CoverPrice = Open;
> > //---------------------------Moneymanagement
> > MarginDeposit=5500;
> > PositionSize=MarginDeposit;
> > PointValue=25;
> > 
> > SwtchGeluid=1;            
> > Out=Cross(TimeNum(),195500);
> > sethour=TimeNum()>090000 AND TimeNum()<194500;
> >  
> > LRSBval= 0.12; 
> > LRSBval    = Optimize("LRSBval",      0.25,  0.05,   0.3,  0.01);
> > LRSSval = LRSBval;   
> > //LRSSval    = Optimize("LRSSval",      0.17,  0.05,   0.3,  
0.01);
> > Length3 = 8;     
> > Length3    = Optimize("Length3",        22,     5,    25,     1);
> > 
> > Length4 = Length3 ;  
> > FDBLen = Length3;  
> > FDSLen = FDBLen ;  
> > MAvgLen = Length3 ;
> > 
> > FDBuy = 41;
> > FDBuy      = Optimize("FDBuy",          10,    10,    50,     1);
> > FDSell = 100-FDBuy; 
> > 
> > PctAbvMA = 0.04; 
> > PctAbvMA   = Optimize("PctAbvMA",     0.07,  0.01,   0.3,  0.01);
> > PctBlwMA = 0.08;
> > PctBlwMA   = Optimize("PctBlwMA",     0.22,  0.01,   0.3,  0.01);
> >  PctAbvMAValue = MA(Avg,MAvgLen) * (100- PctAbvMA) / 100;
> >  PctBlwMAValue = MA(Avg,MAvgLen) * (100+ PctBlwMA) / 100; 
> >  FDBVal = StochD(FDBLen); 
> >  FDSVal = StochD(FDSLen); 
> >  condition1 = Avg < PctAbvMAValue;
> >  condition2 = Avg > PctBlwMAValue; 
> >  condition3 = LinRegSlope(Avg,length3)<LRSBval;
> >  condition4= LinRegSlope(Avg,Length4)>LRSSval;
> >  condition5= (FDBVal <= FDBuy AND FDBVal > Ref(FDBVal,-1)) OR 
(Ref 
> > (FDBVal, -1) <= FDBuy AND FDBVal > Ref(FDBVal,-1)); 
> >  condition6= (FDSVal >= FDSell AND FDSVal < Ref(FDSVal,-1)) OR 
> (Ref 
> > (FDSVal,-1) >= FDSell AND FDSVal < Ref(FDSVal,-1));
> >  PlotShapes((condition1 AND condition3 AND condition5)
> > *shapeUpArrow,  colorBrightGreen,0,L);
> >  PlotShapes((condition2 AND condition4) 
> > *shapeDownArrow,colorBlue,0,H);
> >  Plot(C,"",colorGreen,64);
> > Buy=(condition1 AND condition3 AND condition5) AND  sethour;
> > Short=(condition2 AND condition4) OR Out;
> > Sell=Short;
> > Cover=Buy;
> > Buy=ExRem(Buy,Sell);Sell=ExRem(Sell,Buy); Short=ExRem
> > (Short,Cover);Cover=ExRem(Cover,Short);
> > 
> > 
> > Willem Jan
> > 
> >  --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> 
> wrote:
> > > CONDITION3 IS A VALUE NOT A CONDITION
> > > 
> > > On 7/7/05, me_rayme <rayme@xxxx> wrote:
> > > > Have tried different symbols and can get Both yellow and 
green
> > > > arrows on ER2 one minute, also on EOD get both on some dow 
> > stocks.
> > > > 
> > > > Not sure if this can be used on the futures one minute. The 
> > yellow
> > > > arrows on YM do not make sense and on ER2 both the yellow 
and 
> > green
> > > > do not indicate anything.
> > > > 
> > > > But this is worth a study, very interesting. Will see if I 
can 
> > make
> > > > changes for the futures.
> > > > 
> > > > Ray
> > > > 
> > > > --- In amibroker@xxxxxxxxxxxxxxx, Graham <kavemanperth@xxxx> 
> > wrote:
> > > > > condition3 is a value not a condition
> > > > >
> > > > > On 7/7/05, me_rayme <rayme@xxxx> wrote:
> > > > > > I have tested the code on YM RT one minute. Seems to 
work 
> ok 
> > on
> > > > the
> > > > > > Yellow marker, But no Green up marks.
> > > > > >
> > > > > > Seems like a problem exists on Cond 1, 3, and 5. I have 
> made
> > > > slight
> > > > > > changes.
> > > > > >
> > > > > > Ray
> > > > > >
> > > > > > LRSBval= -0.12;
> > > > > > LRSSval = 0.11;
> > > > > > Length3 = Length4 = FDBLen = FDSLen = MAvgLen = 20;
> > > > > > FDBuy = 6;
> > > > > > FDSell = 94;
> > > > > > PctAbvMA = .1;
> > > > > > PctBlwMA = .05;
> > > > > > PctAbvMAValue = MA(C,MAvgLen) * (100- PctAbvMA) / 100;
> > > > > > PctBlwMAValue = MA(C,MAvgLen) * (100+ PctBlwMA) / 100;
> > > > > >
> > > > > > FDBVal = StochD(FDBLen);
> > > > > > FDSVal = StochD(FDSLen);
> > > > > >
> > > > > > condition1 = C < PctAbvMAValue;
> > > > > > condition2 = C > PctBlwMAValue;
> > > > > > condition3 = LinRegSlope(C,length3)*LRSSval;
> > > > > > condition4 = LinRegSlope(C,20)>LRSSval;
> > > > > >
> > > > > > condition5 = (FDBVal <= FDBuy AND FDBVal > Ref(FDBVal,-
1))
> > > > > > OR (Ref(FDBVal, -1) <= FDBuy AND FDBVal > Ref(FDBVal,-
1));
> > > > > >
> > > > > > condition6= (FDSVal >= FDSell AND FDSVal < Ref(FDSVal,-
1))
> > > > > > OR (Ref(FDSVal,-1) >= FDSell AND FDSVal < Ref(FDSVal,-
1));
> > > > > >
> > > > > > PlotShapes((condition1 AND condition3 AND condition5)
> > > > > > *shapeUpArrow,colorBrightGreen,0,L);
> > > > > >
> > > > > > PlotShapes((condition2 AND condition4)
> > > > > > *shapeDownArrow,colorYellow,0,H);
> > > > > >
> > > > > > //Plot(C,"",colorGreen,64);
> > > > > > Plot( Close, "", colorBlack, styleCandle );
> > > > > > GraphXSpace =10;
> > > > > >
> > > > > >
> > > > > > --- In amibroker@xxxxxxxxxxxxxxx, "ricko8294_98" 
> <ricko@xxxx>
> > > > wrote:
> > > > > > > I have made a stab at translating the code.
> > > > > > > I have to assume that the function LSR() is LinRegSlope
()
> > > > > > > I have also added a line to plot the stock.
> > > > > > >
> > > > > > > Perhaps someone can check this code
> > > > > > >
> > > > > > > LRSBval= -0.12; LRSSval = 0.11;
> > > > > > > Length3 = Length4 = FDBLen = FDSLen = MAvgLen = 20;
> > > > > > > FDBuy = 6; FDSell = 94; PctAbvMA = .1; PctBlwMA = .05;
> > > > > > > PctAbvMAValue = MA(C,MAvgLen) * (100- PctAbvMA) / 100;
> > > > > > > PctBlwMAValue = MA(C,MAvgLen) * (100+ PctBlwMA) / 100;
> > > > > > > FDBVal = StochD(FDBLen);
> > > > > > >
> > > > > > > FDSVal = StochD(FDSLen);
> > > > > > > condition1 = C < PctAbvMAValue;
> > > > > > > condition2 = C > PctBlwMAValue;
> > > > > > > condition3 = LinRegSlope(C,length3)*LRSSval;
> > > > > > > condition4= LinRegSlope(C,20)>LRSSval;
> > > > > > > condition5= (FDBVal <= FDBuy AND FDBVal > Ref(FDBVal,-
> 1)) 
> > OR
> > > > (Ref
> > > > > > > (FDBVal, -1) <= FDBuy AND FDBVal > Ref(FDBVal,-1));
> > > > > > > condition6= (FDSVal >= FDSell AND FDSVal < Ref(FDSVal,-
> 1)) 
> > OR
> > > > (Ref
> > > > > > > (FDSVal,-1) >= FDSell AND FDSVal < Ref(FDSVal,-1));
> > > > > > > PlotShapes((condition1 AND condition3 AND condition5)
> > > > > > *shapeUpArrow,
> > > > > > > colorBrightGreen,0,L);
> > > > > > > PlotShapes((condition2 AND condition4)
> > > > > > > *shapeDownArrow,colorYellow,0,H);
> > > > > > > Plot(C,"",colorGreen,64);
> > > > > > >
> > > > > > > Hope it helps
> > > > > > > Rick
> > > > > > >
> > > > > > > --- In amibroker@xxxxxxxxxxxxxxx, "m.smith" <ink@xxxx> 
> > wrote:
> > > > > > > >
> > > > > > > > This is a "pivot formula" not in amibroker. Will 
> someone
> > > > look at
> > > > > > > this and
> > > > > > > > see if it can be translated? I have been hasseling 
> with 
> > this
> > > > > > > probably more
> > > > > > > > than it is worth. Thanks. Marshall
> > > > > > > >
> > > > > > > > {scalper pivot points } Input: LRSBval(-0.12), 
{level 
> > which
> > > > buys
> > > > > > > must be
> > > > > > > > below} LRSSval(0.11), {level which sells must be 
above}
> > > > Length3
> > > > > > (20),
> > > > > > > {Length
> > > > > > > > for Buy LRS} Length4(20),{Length for Sell LRS} FDBLen
> > (20),
> > > > > > {Number
> > > > > > > of bars
> > > > > > > > to use for FastD calculation for Buy side} FDSLen
(20),
> > > > {Number
> > > > > > of
> > > > > > > bars to
> > > > > > > > use for FastD calculation for Sell side} FDBuy(6), 
> > {Value of
> > > > > > FastD
> > > > > > > to Signal
> > > > > > > > long entry} FDSell(94), {Value of FastD to Signal 
Short
> > > > entry}
> > > > > > > MAvgLen(20),
> > > > > > > > PctAbvMA(.1), PctBlwMA(.05);
> > > > > > > > Vars: PctAbvMAValue(0.0), PctBlwMAValue(0.0), FDBVal
> > (0.0),
> > > > FDSVal
> > > > > > > (0.0),
> > > > > > > > FastDValL(0.0), FastDValS(0.0);
> > > > > > > > PctAbvMAValue = (Average(Close,MAvgLen) * (100- 
> > PctAbvMA) /
> > > > 100);
> > > > > > > > PctBlwMAValue = (Average(Close,MAvgLen) * (100+ 
> > PctBlwMA) /
> > > > > > 100);
> > > > > > > > FDBVal = FastD(FDBLen);
> > > > > > > > FDSVal = FastD(FDSLen); condition1 = C < 
PctAbvMAValue;
> > > > > > > > condition2 = C > PctBlwMAValue;
> > > > > > > > condition3=LinearregSlope(C,length3)LRSSval;
> > > > > > > > condition4= LRS(C,20)>LRSSval;
> > > > > > > > condition5= (FDBVal <= FDBuy AND FDBVal > FDBVal[1]) 
OR
> > > > (FDBVal
> > > > > > [1]
> > > > > > > <= FDBuy
> > > > > > > > AND FDBVal > FDBVal[1]);
> > > > > > > > condition6= (FDSVal >= FDSell AND FDSVal < FDSVal
[1]) 
> OR
> > > > (FDSVal
> > > > > > [1]
> > > > > > > >=
> > > > > > > > FDSell AND FDSVal < FDSVal[1]);
> > > > > > > > if condition1 AND condition3 AND condition5 then 
begin 
> > Plot1
> > > > (L -
> > > > > > >  .5,"GoLong
> > > > > > > > ); end; if condition2 AND condition4 AND condition6 
> then
> > > > begin
> > > > > > Plot2
> > > > > > > (H + .5,
> > > > > > > > GoShort");
> > > > > > > > end;
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Please note that this group is for discussion between 
> users 
> > only.
> > > > > >
> > > > > > To get support from AmiBroker please send an e-mail 
> directly 
> > to
> > > > > > SUPPORT {at} amibroker.com
> > > > > >
> > > > > > For other support material please check also:
> > > > > > http://www.amibroker.com/support.html
> > > > > >
> > > > > >
> > > > > > Yahoo! Groups Links
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Cheers
> > > > > Graham
> > > > > http://e-wire.net.au/~eb_kavan/
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > Please note that this group is for discussion between users 
> only.
> > > > 
> > > > To get support from AmiBroker please send an e-mail directly 
to
> > > > SUPPORT {at} amibroker.com
> > > > 
> > > > For other support material please check also:
> > > > http://www.amibroker.com/support.html
> > > > 
> > > > 
> > > > Yahoo! Groups Links
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > > 
> > > 
> > > 
> > > -- 
> > > Cheers
> > > Graham
> > > http://e-wire.net.au/~eb_kavan/




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/DldnlA/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For other support material please check also:
http://www.amibroker.com/support.html

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/