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

RE Stop Coding Question



PureBytes Links

Trading Reference Links

>Hello,

>I want to code a simple approach but got some problems with my stop and how
>often the system should trade.

>If the condition is met the system should buy and after a profittarget of 15
>points the system should exitlong ( only long trades for this example and I
>use Ts2k).
>However I want to risk 5 points for stop loss and the system should only
>trade the first signal of the day.

>entry and profit target are working but I need help to code the stop loss
>and the "first signal of the day only".
>Maybe anyone could point me to the right code.

>Thanks in advance
>Jim

>input: fastlen(13), slowlen(34), target(15), risk(5);
>var: orderprice(0);

>value1 = xaverage(c,fastlen);
>value2= xaverage(c, slowlen);

>if value1>value1[1] and value2>value2[1] then begin
>    buy next bar at open;
>end;

>if marketposition = 1 then begin
>orderprice = entryprice + target:
>exitlong at orderprice limit;
>end;
----------------------------------------------
-------------------------------------------------
Try adding something like this,

VAR: DATEFLAG(0);

IF DATE > DATE[1] THEN
DATEFLAG = 0;

IF VALUE1>VALUE1[1] and VALUE2>VALUE2[1] and DATEFLAG = 0 then ...

IF MARKETPOSITION = 1 THEN BEGIN
DATEFLAG = 1
orderprice = ...... etc

Tom.


--

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.