pyramidyng

Hi @ll

Im looking for a formula to closed part of my position :

example;

{long entry}
If {condition 1} then buy H + {condition2} stop;

{long enrty 2)
if Marketposition=1 and (condition1) then buy H + {condition2} stop;

If I try to exit only the long enrty 2 and I put into the signal Exitlong formula tradestation close me all contracts.

Can somebody help me?
 
set a variable as a flag with value of either 1 or 0 within your condition.

If condition then begin
buy;
ok_flag=1;
end;

then you can refer to this variable to control other parts of your code. If ok_flag = 1 then "DO WHATEVER"
 
O.K. let check on this exaple - If U can
I want to stopped "next bar" position on today's lowest price - 1:


Vars:MP(0),EntryLow(0),EntryHigh(0),StopLong(0),StopShort(0),StopPLLong(0),StopPSShort(0);

MP = Marketposition;
{long 2 contracts entry}
If Marketposition <> 1 then begin
If average (c,3) > average (c,5) then buy 2 contracts H + AvgTrueRange(1) stop;
end;

{long 1 contracts (pyramiding) entry}
If Marketposition = 1 and
MP =1 then begin
If marketposition=1 and MP=1 then EntryHigh = H +AvgTrueRange(1);
If MarketPosition = 1 and average (c,3) > average (c,5) then buy ("PL") 1 contracts at EntryHigh stop;
end;

{long 2 contracts exit stop}

If MarketPosition =1 and MP=1 and MP[1]<>1 then begin
If MarketPosition =1 and MP=1 and MP[1]<>1 then StopLong = L[1];
If MarketPosition = 1 then ExitLong 2 contracts at StopLong - 1 Stop;
end;

{long 1 contracts (pyramiding) exit stop}
If MP=1 and MP[1]=1 then begin
If Marketposition = 1 and Currentcontracts = 3 then StopPLLong = L [1];
If MarketPosition =1 and CurrentContracts =3 then ExitLong 1 contracts at StopPLLong - 1 Stop;
end;

This not working good
:mad:

Stoped 2 contracts in the same time when it open
 
Back
Top