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

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;