Zdravím příznivce tradingu. Rád bych použil strategii pro easylanguage, ale nedaří se mi správně zadat formulaci. CCi 50 a CCi 14. Pravidlo vstupu pro long: Když CCi 50 překročí 0 linku směrem na horu a CCi 14 současně překročí +100 do extrémní oblasti koupit 1 kontrakt .
Pravidlo pro vstup short: Když CCi 50 překročí 0 linku směrem dolů a současně CCi 14 překročí -100 do extrémní oblasti koupit short 1 kontrakt.
Obchodní hodiny: 9.00-11.00
16.00-21.00
počet kontraktů: 1
stop-loss: 30tick
profit-target: 50tick
{
Requirements:
I am trying to code a basic strategy with CCi 50 and CCi 14.
Input rule for long: The concept is when the CCI 50 crossing up 0 line and CCI 14 crossing up (+100)
through the overbought line then buy 1 contract.
Input rule for short: When the CCI 50 crossing down 0 line and CCI 14 crossing down (-100) through
the oversold line then go short 1 contract.
I tried to piece together a code from looking through the forums but it is not picking them.
Business hours: 9.00 to 11.00 and 16.00 to 21.00
}
Inputs:
BegTime1( 900 ),
EndTime1( 1100 ),
BegTime2( 1600 ),
EndTime2( 2100 ),
CCIFastLen( 14 ),
CCISlowLen( 50 ),
CCISlowLongCross( 0 ),
CCIFastLongCross( 100 ),
CCISlowShortCross( 0 ),
CCIFastShortCross( -100 ) ;
Variables:
TimeOkay( false ),
Double CCISlow( 0 ),
Double CCIFast( 0 ) ;
// Calc CCI Slow and Fast
CCISlow = CCI( CCISlowLen ) ;
CCIFast = CCI( CCIFastLen ) ;
SetStopShare ;
SetStopLoss (.001 ) ;
SetProfitTarget ( .003 ) ;
// Determine if the time for entry / reversal is okay
TimeOkay = ( Time >= BegTime1 and Time
( Time >= BegTime2 and Time
// *** Changed here: Enter long if the CCI slow HAS ALREADY crossed above
// the user-specified value ( changed from "crosses above" to ">" ) and the
// CCI fast crosses over the user-specified value AT THE SAME BAR
// and the time is okay for entry ( or reversal from short )
if CCISlow > CCISlowLongCross and
CCIFast crosses above CCIFastLongCross and
TimeOkay then
Buy at next bar at market ;
// *** Changed here: Enter short if the CCI slow HAS ALREADY crossed below
// the user-specified value ( changed from "crosses below" to "
// CCI fast crosses below the user-specified value AT THE SAME BAR
// and the time is okay for entry ( or reversal from short )
if CCISlow
CCIFast crosses below CCIFastShortCross and
TimeOkay then
SellShort at next bar at market ;
// Example print debug statement to print out key variables each bar
// to help trouble-shoot the code
print( " Date=", Date:0:0, " Time=", Time:4:0, " CCISlow=", CCISlow:0:2,
" CCIFast=", CCIFast:0:2, " TimeOkay=", TimeOkay,
" MktPos=", MarketPosition:0:0 ) ;
stále se nedaří uvást do provozu. ???
Dostává takovouhle odpověď.
Event: Elsystem. Max bars Exception: Tried to reference more bars than allowed by the current Max Bars Back setting.
Můžete mi s tím prosím poradit. Děkuji předem za odpověď.