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

Re: Money Management Easy Language problem



PureBytes Links

Trading Reference Links

Mr Coding,

I verified your're code in TS4 and it makes a few trades but none after
you're ExPrftl1 and l2 exits are hit. It looks like you have a logic
error. You're "If marketposition = 1" loop encompasses an "If
marketposition = -1" loop.

Best,
Bill

----- Original Message ----- 
From: "Coding" <elaels@xxxxxxxxx>
To: <omega-list@xxxxxxxxxx>
Sent: Tuesday, August 05, 2003 6:52 PM
Subject: Money Management Easy Language problem


> Hi!
>
> I'm trying to buy or sell 2 contracts at each signal
> and have 2 different profit targets and 2 different
> stop losses.
>
> I'm doing something really wrong in the code logic,
> since it does not generate any signal.
>
> I'm suppose to have only one trade of 2 contracts per
> signal.
>
> any help appreciated
>
> Eduardo
>
>
>
>
>
>
> {Code #4:}
> Inputs:  Price(Close),     { series to perform
> analysis on }
>          Len1(3),     { fast MA length }
>          Len2(21);     { slow MA length }
>
> Variables: FMA(0),SMA(0),OkToBuy(True),OkToSell(True);
>
> FMA=Average(Price,Len1); {Fast Moving Average}
> SMA=Average(Price,Len2); {Slow Moving Average}
>
> {==== Entry Orders ===}
> if FMA > SMA and close > SMA and OkToBuy then begin
> Buy("Buy1") 1 contract on Close;
>     Buy("Buy2") 1 contract on Close;
> OkToBuy=False;
> OkToSell=True;
> end;
>
> If marketPosition=1 then begin
>     Exitlong("ExPrftl1")  from Entry("Buy1") at
> entryprice+0.75 limit;
>     Exitlong("ExPrftl2")  from Entry("Buy2") at
> entryprice+1.25 limit;
>     Exitlong("ExStpl1")  from Entry("Buy1") at
> entryprice-1.25 stop;
>     Exitlong("ExStpl2")  from Entry("Buy2") at
> entryprice-2.00 stop;
>
> if FMA < SMA and close < SMA and OkToSell then begin
>
>   sell ("Sell1") 1 contract on Close;
>     sell ("sell2") 1 contract on Close;
> OkToSell=False;
> OkToBuy=True;
> end;
>
> If Marketposition=-1 then begin
>     Exitshort("ExPrfts1")  from Entry("sell1") at
> entryprice+0.75 limit;
>     Exitshort("ExPrfts2")  from Entry("sell2") at
> entryprice+1.25 limit;
>     Exitshort("ExStps1")  from Entry("sell1") at
> entryprice-1.25 stop;
>     Exitshort("ExStps2")  from Entry("sell2") at
> entryprice-2.00 stop;
> end;
>   end;
>
>