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

Re: help with AFL - repost



PureBytes Links

Trading Reference Links

Hello,

below must be the answer to your question,
I am sorry but I use the rem.dll ( new release in third party)
it takes less time to write your system and exchange ideas 
than to write a help that nobody understand with my fine franglish

stephane




Buycond = Cross(ATR(30),ATR(3)); // for example
BuyHold = Hold (Ref(Buycond,-1), 5); // you can act only next 
bar //after you know the buycondition reason why ref
Buystop = ValueWhen(Buycond,H+0.01);
Buy= Cross(H,Buystop) AND Buyhold;
Buy= Hold(Buy==0,2) AND Buy;// convert to one peak
BuyPrice=Max(Open,Buystop);

/*****************************/
Entryprice= BuyPrice;/*entryprice*/
StopPrice= L; // this is the price option for stoploss and 
trailingstop 
StopLoss= Ref(L,-1) ;
Trailstop= -1; // disable
Target= Close*1e10 ;//disable
Counter= 4; //sell after 4 days
Bars= -1 ; // disable 

scRemBuyTrail(Buy,Entryprice,
StopPrice,StopLoss,TrailStop,
Target,Counter,Bars);

Buy=Buy;
Sell=Sell;
BuyPrice=Entryprice;/*array*/
SellPrice=SellPr;/*array*/

Entryprice=ValueWhen(Buy,Entryprice);
Stoploss=ValueWhen(Buy,StopLoss);
profit =ValueWhen(Buy,Target) ; 
Trail=HighestSince(Buy,Trailstop);

MaxGraph=14;
Plot(Close,"close",IIf( Buy, 6, IIf(Sell , 4 ,1 )),64);
Plot(Entryprice,"Ep",3,1);
Plot(Stoploss,"stop",4,1);
//Plot(Profit,"Profit",7,1);
//Plot(TargetPr,"",6,1);
//Plot(TrailPr,"TrailPr",5,1);
Plot(ValueWhen(Sell,SellPrice),"",2,1);

//Plot(Buy*10,"",6,2);
//Plot(Sell*5,"",7,2);
> I'm reposting this since I still haven't figured it out.
> 
> Here's what I'm trying to code.
> 
> Entry:
> - based on certain buy conditions (called Buyconditions in my AFL)
> - hold buy conditions to be true for "x" days (after which, a buy 
> should not occur, even if the buy conditions are still true)
> - buy price should be "y" more than the high of the day the buy 
> signal occurred (i.e. High + y)
> 
> Exit:
> - sell at the close if "z" days have passed OR sell if the price 
goes 
> below the low of the day before buy signal occurred, i.e. Ref(L, -
1)
> 
> Here's my AFL so far but it doesn't seem to do what I'm trying to 
> do. Any help would be GREATLY appreciated.
> 
> Buy = 
> Buyconditions
> ;
> 
> Buy = Hold (Buy, x);
> 
> BuyPrice = ValueWhen(Buy, High) + y;
> 
> Sellcond1 = Ref(Buy,-z); // sell after z days
> Sellcond2 = L <= ValueWhen(Buy, Ref(L,-1)); // sell if price goes 
> below the low of the day before the buy signal occurred
> 
> Sell =
> Sellcond1 OR Sellcond2
> ;
> 
> SellPrice= IIf(Sellcond1, C, ValueWhen(Buy, Ref(L,-1))); // If z 
> days have passed, sell at the close. If price has dropped below 
the 
> low, sell at that low.
> 
> /////////////////