PureBytes Links
Trading Reference Links
|
I think you need to move the "end;" up to close the if statement for going
long, i.e., before if FMA < SMA (and therefore remove one of the end remarks
from the end of the code).
Please see below.
Navtej
----- Original Message -----
From: "Coding" <elaels@xxxxxxxxx>
To: <omega-list@xxxxxxxxxx>
Sent: Tuesday, August 05, 2003 7: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;
> END GOES HERE
> 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;
>
>
|