Hong Kong
Posts: 10 since Feb 2015
Thanks Given: 1
Thanks Received: 0
|
After loading the The power language below into multicharts it took forever to calculate and load. I wonder what went wrong. Please help... THanks.
[IntraBarOrderGeneration=TRUE]
Input:
TradeCost (1000),
TradeTimeStart (0900),
TradeTimeEnd (1500),
AccFactorStep( 0.14 ),
AccFactorLimit( 0.2 ),
BreakEvenPct (10),
StopLossPct (10),
dailyloss (3000),
DMIP (14),
ADXlen (14);
Variables:
TradeOK (false), //Trade
TrdQty (0), // Number of Contracts
StopAmt (0),
ActualCost (0),
EntryPrice (0),
Position (0),
//SetBreakEven (0),
FloorAmt (0),
//SetStopLoss (0),
Value1 (0),
Value2(0),
Value3 (0),
todaynet (0),
yesterdaynet (0),
oParCl( 0 ), oParOp( 0 ), oPosition( 0 ), oTransition( 0 ) ;
Value1 = ParabolicSAR( AccFactorStep, AccFactorLimit, oParCl, oParOp, oPosition, oTransition ) ;
Value2 = ADX(ADXlen);
Value3 = DMIPlus (DMIP);
// TrdQty = IntPortion(TradeCost/(100*Close));// Round off the entry contracts.
Position = IntPortion(TradeCost/(100*EntryPrice)); //Actual Position Contracts.
ActualCost = Position * EntryPrice * 100;
StopAmt = ActualCost * StopLossPct/100;
FloorAmt = ActualCost * (BreakEvenPct/100);
{Determine if current time is within valid market session by setting
the TradeOK to TRUE which will allow new position to be opened (traderslaboratory.com)}
if (Time > TradeTimeStart) AND (Time < TradeTimeEnd) then
TradeOK = True;
If date <> date [1] then begin
yesterdaynet = NetProfit;
end;
if MarketPosition = 0 then begin
todaynet = NetProfit - yesterdaynet;
condition1 = -dailyloss < todaynet;
// Buy if SAR -1, DMI >15
If (TradeOK) And (MarketPosition=0) And (oPosition = -1)
And (Value2>15) And (Value3 >20) And (condition1 = True) Then Begin
Buy ( "Buy-SAR" ) Next Bar {TrdQty Contracts} at Market;
// Set Stops.
//SetStopPosition;
SetStopLoss(StopAmt);
SetBreakEven (FloorAmt);
End;
// Sell for Profit if SAR = +1
If (MarketPosition=1) And (oPosition = 1) Then Begin
Sell ( "Sell" ) Next Bar at Market;
End;
If (TradeOK = False) And (MarketPosition=1) Then Begin
Sell ( "SellTime" ) Next Bar at Market;
End;
End;
|