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

RE: Coding MaxLoss and ProfitTarget Stops



PureBytes Links

Trading Reference Links

So something like this would be a good substitute If(H > Ref(H,-20)
,Ref(OPEN,+1),0) for Williams buy Stop. It gives next day OPEN when High
is higher that 20 days ago.

I believe it would be perfectly possible to include commissions into
your MaxLoss code, you could include it as a input.

Greetings
Mickey

-----Original Message-----
From: owner-metastock@xxxxxxxxxxxxx
[mailto:owner-metastock@xxxxxxxxxxxxx] On Behalf Of Roy Larsen
Sent: woensdag 29 augustus 2001 01:59
To: metastock@xxxxxxxxxxxxx
Subject: Re: Coding MaxLoss and ProfitTarget Stops


Herman

My code returns the entry price (stop value).

Just substitute any entry of your own choosing, it doesnt matter. See
the gif in my previous post.

Roy


----- Original Message ----- 
From: "Herman van den Bergen" <psytek@xxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: Wednesday, 29 August 2001 10:19
Subject: Re: Coding MaxLoss and ProfitTarget Stops


> At 07:32 AM 8/29/01 +1200, you wrote:
> >The "Williams Buy Stop" indicator is a breakout entry signal based on

> >the
> work of Bill Williams I believe his book is called "New Dimensions in 
> Trading". I didn't create the indicator and don't have permission to 
> pass it on, but the concept is to enter long once a the price breaks 
> above a previous high that is straddled by two lower highs on each 
> side.
> 
> Hi Roy, no need to post the formula, but could you tell me what value 
> the formula returns so that I can substitute something else for 
> testing purposes?
> 
> Many thanks,
> Herman.
> 
> >
> >The signals are most likely contained in the password protected 
> >expert
> called "Profitunity - Bill
> >Williams".
> >
> >Perhaps someone who has developed the code from the book might like 
> >to
> share it.
> >
> >Roy
> >
> >> This is great work you are posting here. And I'm eagerly to give it

> >> a try, but what is "Williams Buy Stop" indicator ? Is that the 
> >> entry point of the system ? Thanks
> >> Mickey
> >>
> >> -----Original Message-----
> >> From: owner-metastock@xxxxxxxxxxxxx 
> >> [mailto:owner-metastock@xxxxxxxxxxxxx] On Behalf Of Roy Larsen
> >> Sent: dinsdag 28 augustus 2001 11:49
> >> To: metastock@xxxxxxxxxxxxx
> >> Subject: Re: Coding MaxLoss and ProfitTarget Stops
> >>
> >>
> >> Herman
> >>
> >> > Has anybody succeeded handcoding the Maximum Loss and Profit 
> >> > Target Stops such that System Tester Stop results are identical 
> >> > to using the custom coded stops?
> >> >
> >> > I am having great difficulty getting similar results and would 
> >> > appreciate any suggestions or pieces of code that can help me.
> >>
> >> Here is a sampling of work-in-progress on profit stops for MS. I 
> >> have yet to check any of these against MS but will do so over the 
> >> next few days. For the life of me I can't see how MS stops can 
> >> execute at tradeable steps - see comments on code further down.
> >>
> >> Thanks to Glen Wallace for his comments, and the code above his 
> >> name from the Guppy site. I never intended to use the PREV function

> >> but it appears to be the only way to go without programming skills 
> >> and a development kit.
> >>
> >> The Target Exit indicator is by far the slowest in use (for 
> >> multi-stock system testing) as the Entry variable combines the all 
> >> 3 elements of profit, loss and time. When testing it I called the 
> >> appropriate stop using FmlVar()'s rather than the usual Fml() that 
> >> is used with single purpose indicators.
> >>
> >> With Profit Stop I have added some code to convert the stop value 
> >> to the next higher ASX tradeable step. Similar code could be added 
> >> to a stop loss or exit stop by those who need it (i.e. have their 
> >> own stop capable system tester).
> >>
> >> I'm going to have a lot more fun with this stuff yet. There are a 
> >> number of possibilities yet to explore. I hope there is something 
> >> here that will help or give you inspiration.
> >>
> >> Roy
> >>
> >> {Profit Exit - entered on Close}
> >> Profit:=Input("Profit target %",1,50, 5)/100; Entry:=Fml("Williams 
> >> Buy Stop"); EntryAmt:=If(PREV<=0,If(Entry>0,CLOSE,0),
> >>   If(H>PREV*(1+Profit),-PREV,PREV));
> >> Target:=Abs(EntryAmt)*(1+Profit);
> >> EntryAmt<0 AND H>Target;  {binary exit signal}
> >>
> >> {Profit Exit - entered on Open}
> >> Profit:=Input("Profit target %",1,50, 5)/100; Entry:=Fml("Williams 
> >> Buy Stop"); EntryAmt:=If(PREV<=0,If(Entry>0,OPEN,0),
> >>   If(H>PREV*(1+Profit),-PREV,PREV));
> >> Target:=Abs(EntryAmt)*(1+Profit);
> >> EntryAmt<0 AND H>Target; {binary exit signal}
> >>
> >> {Profit Exit - entered on Stop}
> >> Profit:=Input("Profit target %",1,50, 5)/100; Entry:=Fml("Williams 
> >> Buy Stop"); EntryAmt:=If(PREV<=0,If(Entry>0,Entry,0),
> >>   If(H>PREV*(1+Profit),-PREV,PREV));
> >> Target:=Abs(EntryAmt)*(1+Profit);
> >> EntryAmt<0 AND H>Target; {binary exit signal}
> >>
> >> {Profit Stop - entered on Stop}
> >> Profit:=Input("Profit target %",1,50, 5)/100; Entry:=Fml("Williams 
> >> Buy Stop"); EntryAmt:=If(PREV<=0,If(Entry>0,Entry,0),
> >>   If(H>PREV*(1+Profit),-PREV,PREV));
> >> Target:=Abs(EntryAmt)*(1+Profit);
> >> X:=If(EntryAmt<0 AND H>Target,Target,0); Stop:=If(X=0,0,If(X>0.1 
> >> AND X<=0.5, If(Int(X*200)=X*200,X+.005, Int((X+.005)*200)/200), 
> >> If(X<=0.1, If(Int(X*1000)=X*1000,X+.001, Int((X+.001)*1000)/1000), 
> >> If(Int(X*100)=X*100,X+.01, Int((X+.01)*100)/100)))); Stop; {Value 
> >> exit signal}
> >>
> >> {Target Exit}
> >> Profit:=Input("Percent profit",1,50, 5)/100;
> >> Loss:=Input("Percent loss"    ,1,50,50)/100;
> >> Time:=Input("Maximum trade duration",1,50,2); Entry:=Fml("Williams 
> >> Buy Stop"); Init:=Cum(Entry<>-1)=0; 
> >> EntryPrice:=If(PREV<=0,If(Entry>0,Entry,0),
> >>   If(H>PREV*(1+Profit)
> >>   OR L<=PREV*(1-Loss)
> >>   OR BarsSince(PREV=0)>=Time,-PREV,PREV));
> >> Trade:=Init=0 AND EntryPrice<>0; 
> >> ProfitTarget:=Abs(EntryPrice)*(1+Profit);
> >> LossTarget:=Abs(EntryPrice)*(1-Loss);
> >> ProfitExit:=If(EntryPrice<0 AND H> ProfitTarget,ProfitTarget,0); 
> >> LossExit:=If(EntryPrice<0 AND L<= LossTarget,LossTarget,0); 
> >> ProfitExit:=If(EntryPrice<0 AND ProfitExit=0 AND 
> >> LossExit=0,O,ProfitExit); LossTarget; ProfitTarget;
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
> 
>