Dear friends
Please help a newbie here - am trying to add dailyprofittarget and dailyloss to a simple moving average cross strat.. I added a dailyprofit/loss code that Big Mike posted a long time ago here...what's wrong there?
Thanks for ANY help!
This is the code:
// for use in signal
inputs:
dailyprofit(500),
dailyloss(250);
vars:
todaynet(0),
yesterdaynet(0);
if date <> date[1] then begin
yesterdaynet = NetProfit;
end;
if MarketPosition = 0 then begin
todaynet = NetProfit - yesterdaynet;
end;
condition1 = -dailyloss < todaynet and todaynet < dailyprofit;
// entries
if condition 1 then begin
inputs:
FastPrice( Close ) [DisplayName = "FastPrice", ToolTip =
"Enter an EasyLanguage expression to use in calculation of shorter length moving average."],
SlowPrice( Close ) [DisplayName = "SlowPrice", ToolTip =
"Enter an EasyLanguage expression to use in calculation of longer length moving average."],
FastLength( ) [DisplayName = "FastLength", ToolTip =
"Enter number of bars to use in calculation of shorter length moving average."],
SlowLength( ) [DisplayName = "SlowLength", ToolTip =
"Enter number of bars to use in calculation of longer length moving average."];
{ CB > 1 check used to avoid spurious cross confirmation at CB = 1 }
if CurrentBar > 1 and FastAvg crosses under SlowAvg then
Sell short 1 contract next bar at market;
setstoploss ();
setprofittarget ();
I think this is your problem, there isn't any variable or input placed in the target and stop functions. Put your profit and stop inputs inside the parentheses.
The following user says Thank You to kjhosken for this post: