if marketposition= 1 and openpositionprofit>winatr1*bigpointvalue then begin
trailing_pt1=(hpeak-entryprice)*0.6+entryprice;
if c<=trailing_pt1 then sell ("trailing1+") next bar market;
end;
if marketposition=-1 and openpositionprofit>winatr1*bigpointvalue then begin
trailing_pt1=entryprice-(entryprice-lpeak)*0.6;
if c>=trailing_pt1 then buytocover ("trailing1-") next bar market;
end;
if marketposition= 1 and openpositionprofit>winatr2*bigpointvalue then begin
trailing_pt2=(hpeak-entryprice)*0.8+entryprice;
if c<=trailing_pt2 then sell ("trailing2+") next bar market;
end;
if marketposition=-1 and openpositionprofit>winatr2*bigpointvalue then begin
trailing_pt2=entryprice-(entryprice-lpeak)*0.8;
if c>=trailing_pt2 then buytocover ("trailing2-") next bar market;
end;
if marketposition= 1 and c<entryprice-lostpt then sell ("stoplostt+") next bar market;
if marketposition=-1 and c>entryprice+lostpt then buytocover ("stoplostt-") next bar market;
請問:以下該如何改寫成XQ
1. openpositionprofit
2. bigpointvalue
3. sell ("trailing1+") next bar market.
4. buytocover ("trailing1-") next bar market.
5. sell ("trailing2+") next bar market.
6. buytocover ("trailing2-") next bar market;
7. sell ("trailing2+") next bar market;
8. buytocover ("stoplostt-") next bar market;
9. sell ("stoplostt+") next bar market;
3 評論