Monday, August 27, 2012

[STAD_01] Pivot System

This system uses pivot(Vol trading) and MA. Basically if MA breaksup each pivot lines the buy signal is getting stronger and stronger.





Input: ProfitPt(5), TrailBar(30), entryCount(1), P1(40), P2(160), P3(110);
Vars: Pivot(0), Support1(0), Support2(0), Support3(0), Resistance1(0), Resistance2(0), Resistance3(0),
BearMarket(false) , BullMarket(false);

// Calculation of Pivot, support and resistance points
Pivot = ( dayLow(1) + dayHIgh(1) + dayClose(1) ) / 3;
Resistance1 = ( Pivot * 2 ) - dayLow(1);
Resistance2 = Pivot + (dayhigh(1)-dayLow(1));
Resistance3 = Resistance1 + (dayhigh(1)-dayLow(1));
Support1 = ( Pivot * 2 ) - dayHIgh(1);
Support2 = Pivot - (dayhigh(1)-dayLow(1));
Support3 = Support1 - (dayhigh(1)-dayLow(1));

// Determination of market character
BullMarket = ma( Close , P1 ) > ma( Close , P2 ) AND ma( Close , P2 ) > ma( Close , P3 );
BearMarket = ma( Close , P1 ) < ma( Close , P2 ) AND ma( Close , P2 ) < ma( Close , P3 );

// Placement of long orders

if EntriesToday(date) < entryCount then begin
If BullMarket then Begin
Buy ("Bull R2", atstop,Resistance2 ) ;
Buy ("Bull R3", atstop, Resistance3) ;
end;
// Placement of short orders
If bearmarket then begin
Sell ("Bear S2", atstop, Support2) ;
Sell ("Bear S3", atstop, Support3) ;
end;
end;
// Exit at first Profitable Open
If MarketPosition == 1 and NextBarOpen > EntryPrice + ProfitPt then
ExitLong ("Long Profit", AtMarket);
If MarketPosition == -1 and NextBarOpen < EntryPrice - ProfitPt then
ExitShort ("Short Profit", AtMarket) ;

// Exit with trailing stops
ExitLong("EL", atstop,Lowest( Low , TrailBar )) ;
ExitShort("ES", atstop, Highest( High , TrailBar )) ;

SetStopEndofday(150000);


Input : nDate(Numeric);
Var : Count(0);

Count = 0 ;
For Value1 = 0 To 10 {
If EntryDate(Value1) == nDate Then
Count = Count + 1;
}

EntriesToday = Count;

-Charles Sin

No comments:

Post a Comment