about code of adding to winning positions...
Posted: Oct 25 2011
hi all, another part of the program is about adding to winning position.
my plan is to add two more contracts to the original position, which made a maximum of three in total. the conditions is to add one more contract every US$50 profit from the previous contract, the code are as follows, but after adding the following code, nothing happen, the strategy can't add to position.
any ideas? thanks!
my plan is to add two more contracts to the original position, which made a maximum of three in total. the conditions is to add one more contract every US$50 profit from the previous contract, the code are as follows, but after adding the following code, nothing happen, the strategy can't add to position.
any ideas? thanks!
Code: Select all
input: add_position_profit(50);
if marketposition = 1 and currentcontracts = 1 then
begin
if PosTradeProfit(0,0) >= add_position_profit then
buy next bar market;
end;
if marketposition = -1 and currentcontracts = 1 then
begin
if PosTradeProfit(0,0) >= add_position_profit then
sellshort next bar market;
end;
if marketposition = 1 and currentcontracts = 2 then
begin
if PosTradeProfit(0,1) >= add_position_profit then
buy next bar market;
end;
if marketposition = -1 and currentcontracts = 2 then
begin
if PosTradeProfit(0,1) >= add_position_profit then
sellshort next bar market;
end;