Hi, I had hoped that someone else would chime in for you here, since I don't trade futures, and don't use stops. But, since nobody else has answered, the best I can do is refer you to the documentation:
http://www.amibroker.com/guide/afl/afl_view.php?name=ApplyStop Mike --- In [email protected], "zanhero" <[EMAIL PROTECTED]> wrote: > > Thank you Mike! > Here is the code I found to work: > > ------------------------------------------------------ > SetOption("MaxOpenPositions", 5 ); > SetBacktestMode( backtestRegularRawMulti ); > SetOption( "FuturesMode", True); > PositionSize = -20; // use 20 percent of equity > MarginDeposit = 1500; // deposit required for 1 pair > RoundLotSize = 1; // trade only round contracts > PointValue = 10/TickSize; //this adjusts profit so for 1 pip = $10 > [tick > //sizes: 0.01 for yen AND 0.0001 for others] > > Cond1 = DayOfWeek () == 1 ; > Cond2 = DayOfWeek () == 2 ; > Cond3 = DayOfWeek () == 3 ; > Cond4 = DayOfWeek () == 4 ; > Cond5 = DayOfWeek () == 5 ; > Cond777 = Cond1 OR Cond2 OR Cond3 OR Cond4 OR Cond5; > > //buy > Buy = Ref ( Close , -1 ) > Ref ( Open , -1) > AND Cond777; > //short > Short = Ref ( Close , -1 ) < Ref ( Open , -1) > AND Cond777; > //exit trade > Sell = Cover = DayOfWeek() == 5 ; > ------------------------------------------------------ > The problem I got now is that I cannot get the stop function to > work, I tried applystop, the build-in stop from settings, nothing > seems to work > I'm looking for an individual trade stop. Let's suppose I have 3 > open trades right now, and one of them is 300 points loss, I want to > exit this one but keep the other ones, what do I have to do? How do I > implement this in afl code? > > Any help appreciated! >
