General Topics
Markets
Technical Topics
Brokerage Firms
Company Specific
Community Lounge
Site Support

pyramidyng

Discussion in 'Index Futures' started by R.A.S., Oct 1, 2002.

1. R.A.S.

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?

2. m_c_a98

you could specify:
If currentcontracts = 2 then exitlong 1 contract

or maybe you could use Flags.

3. R.A.S.

Flags ? What U mean?

4. m_c_a98

set a variable as a flag with value of either 1 or 0 within your condition.

If condition then begin
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"

5. R.A.S.

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

Stoped 2 contracts in the same time when it open

6. m_c_a98

Are you using Daily bars? if not L[1] may not be correct. Try using LowD(1) for yesterdays low.

7. R.A.S.

Yes,daily

ET IS FREE FOR TRADERS BECAUSE OF THE FINANCIAL SUPPORT FROM THESE SPONSORS: