PureBytes Links
Trading Reference Links
|
The fixed deposit works. Percentage also works.
My point is the currency setting in Symbol Information. Setting
EUR.USD to EUR instead of USD is the setting that mimics real-world
behavior.
And also, margin deposit in the real world (at least for Forex trading
on IB) is not fixed as the knowledge base suggests, but dynamic -
based on entry price.
Maybe futures work differently. I have never traded futures.
--- In amibroker@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> wrote:
>
> Ozzy,
>
> I don't trade ForEx, so this is just a guess. But, based on Tomasz's
> earlier replies, it would appear that you are still making the same
> mistake.
>
> Specifically; Set your MarginDeposit to -1/40 (i.e. expressed as the
> percentage -0.025) and NOT hard coded at 2500. Then put the currency
> to USD, as he advised, and see if that works for you.
>
> Mike
>
> --- In amibroker@xxxxxxxxxxxxxxx, "ozzyapeman" <zoopfree@> wrote:
> >
> > Tomasz (and anyone else who cares to comment) -- At the risk of
> turning
> > myself into a major pain in the butt, I must make one more post on
> this
> > subject, if only for the sake of completion. I realize you already
> > mentioned to email support, but I am sure others will benefit. I
> > believe that the Amibroker instructions for setting up Forex may be
> > incorrect. However, I am willing to concede that perhaps I am merely
> > retarded (won't be the first time I've had major misconceptions).
> But
> > first, thank you for your very comprehensive responses on this
> subject,
> > both in this thread, and on the autotrade forum. I spent half the
> day
> > going over your posts and doing some tests with real money. I went
> to
> > my IB Live Account (not the virtual) and did some actual FOREX
> trades.
> > From my TWS account, here are some figures from one such trade, that
> > will serve as a typical example:
> > Short 100,000 EUR.USD @ 1.30078 entry price
> >
> > value: $130,078.00 USDmargin
> > requirement (40:1): $ 3,251.48 cash deducted
> from
> > my acct: $ 3,251.48 + commission The above is no surprise, and
> is
> > exactly what I expected. I did several Short/Cover and Buy/Sells to
> be
> > sure. Now, in order to simulate the above real-world behavior with
> the
> > AB backtester, these are the settings I use: Set Symbol Information
> -->
> > EUR.USD --> Currency to EUR, and not USD as you suggested and as
> > written in the Knowledge Base. I know that EUR.USD is denominated
> in
> > USD, but setting currency to EUR is the only way to get it to work
> > properly. AFL settings:
> > SetOption("FuturesMode", 1);
> > SetOption("InitialEquity", 100000);
> > SetOption("InterestRate",0);
> > SetOption("MaxOpenPositions", 1);
> > SetOption("MinPosValue", 0);
> > SetOption("MinShares", 1);TradeDelays(0, 0, 0, 0);
> > SetPositionSize(1, spsShares);
> > TickSize = 0.0001; // The minimum price move of symbol for
> Forex
> > PointValue = 100000;
> > RoundLotSize = 1;
> > MarginDeposit = 2500;
> > BuyPrice = SellPrice = ShortPrice = CoverPrice = Close; With
> the
> > above settings, the backtester mimics the real world results. Each
> lot
> > of 100,000 Euro is bought with a margin deposit of (100,000 * entry
> > price / 40) US dollars, as it should be, and that amount is
> correctly
> > deducted from Cash for each Entry. The detailed Log Report verifies
> this
> > behavior. If we instead set Symbol Information --> EUR.USD -->
> Currency
> > to USD, then each lot of 100,000 Euro gets purchased with $2,500
> USD.
> > And $2,500 USD is deducted from Cash for each entry, regardless of
> > current EUR.USD price. That is incorrect, and does not mimic the
> real
> > world. Nor does it make any sense that I can fathom. In a similar
> vein,
> > this calculation from the Knowledge Base appears to be incorrect:
> >
> > http://www.amibroker.com/kb/2006/08/09/amibroker-for-forex/
> > <http://www.amibroker.com/kb/2006/08/09/amibroker-for-forex/>
> >
> >
> > "Then - once everything is configured - press BACKTEST button. Now
> > let's have a look at the results list.
> > The profit is calculated as follows:
> >
> > NumContracts * (SellPrice - BuyPrice) * PointValue
> >
> > In the first transaction:
> > - the Entry Price is equal to 1.2154
> > - the Exit Price is equal to 1.2304
> > - NumContracts = 3 (since we trade 3 contracts).
> > - we trade on 1% margin so deposit is $1,000 x 3 = $3,000 (that's
> > expressed in Position Value)....."
> >
> >
> >
> >
> > The $3,000 figure above should instead be: 3 * ($100,000*1.2154 /
> 100
> > ) = $3,646.20
> >
> > I invite anyone out there to test this out for themselves on their
> Forex
> > broker account, using real money. Then try to simulate the trade
> > behavior in the backtester. Then please tell me I'm not crazy!
> >
> > And if turns out that I am crazy, I will eat crow, and slink away,
> only
> > to repost another day in much more humble form. :-)
> >
> >
> >
> >
> >
> >
> >
> >
> > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@> wrote:
> > >
> > > "rather $2,500 multiplied by the dynamic exchange rate!"
> > >
> > > Yes, if you are using dynamic exchange rate and if currencies are
> > > defined in the symbol database.
> > > However EURUSD should not have "EUR" currency defined, because
> > > it is denominated in DOLLARS, not in euros. EURUSD is the amount
> > > of US DOLLARS you get for one euro. So it is denominated in US
> > dollars,
> > > as any US contract. This is different than USDJPY which is
> denominated
> > > in Yen (i.e. it represents amount in Yen you get for one US
> dollar).
> > In that case
> > > the currency should be set to "Yen" in Information window.
> > >
> > > However for EURUSD symbol, the currency in the Information window
> > should be set to USD,
> > > because EURUSD quotes are denominated in US dollars.
> > >
> > > Best regards,
> > > Tomasz Janeczko
> > > amibroker.com
> > > ----- Original Message -----
> > > From: "ozzyapeman" zoopfree@
> > > To: amibroker@xxxxxxxxxxxxxxx
> > > Sent: Thursday, January 22, 2009 4:55 PM
> > > Subject: [amibroker] Re: How to force Backtester to Calculate
> Position
> > Size on Open Price?
> > >
> > >
> > > > Thanks again for the feedback Tomasz. I do realize you are busy
> with
> > > > development and what not, and really appreciate all the
> responses
> > you
> > > > make on this board. Frankly, I don't know where you get the time
> to
> > do
> > > > all that you manage to do!
> > > >
> > > > And it's certainly not my intention to clutter up the board. But
> I
> > > > think that there are a lot of others out there who might share
> my
> > > > confusion on backtesting Forex. The topic does come up from time
> to
> > time.
> > > >
> > > > I will use support for further questions on this issue. But I
> did
> > want
> > > > to point out that, when clicking on detailed log, I see that the
> > > > backtester is in fact working the way I outlined, i.e. it is not
> > > > deducting a static $2,500, as you seem to be saying, but rather
> > $2,500
> > > > multiplied by the dynamic exchange rate!
> > > >
> > > > Anyway, I am sure you are correct in what you were trying to
> point
> > out
> > > > to me, but I must be understanding things differently. I will
> send
> > an
> > > > email to Marcin to see if he can alleviate my confusion. :-)
> > > >
> > > >
> > > >
> > > > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" groups@
> wrote:
> > > >>
> > > >> Hello,
> > > >>
> > > >> > First, I am backtesting Intraday, not EOD, so time stamps are
> > > > relevant.
> > > >>
> > > >> Problem is that I had to guess what you are using since I
> didn't
> > > > find any info
> > > >> about interval in use in previous e-mail and lack of complete
> > > > information
> > > >> about what you are actually doing makes the whole information
> > > > exchange longer.
> > > >>
> > > >> Please do use support at amibroker.com
> > > >> Marcin is sitting there waiting for you to help.
> > > >> It is way better way as we don't want to clutter 9000+ list
> > members'
> > > > inboxes.
> > > >>
> > > >> >How can you say that the price of buying 100,000 EUR is always
> > > > fixed at $2,500 USD no matter how the EUR.USD price fluctuates?!
> > > >> > How could that simulate a realistic backtest?!
> > > >>
> > > >> It is so because you DEFINED it so in your formula using this
> > single
> > > > line:
> > > >> MarginDeposit = 2500;
> > > >>
> > > >> So your calculations are actually incorrect. Only 2500 is
> > subtracted
> > > > from your account
> > > >> (because you have defined constant margin).
> > > >>
> > > >> The information about that is readily available in the manual.
> > > >> http://www.amibroker.com/guide/h_futbacktest.html
> > > >>
> > > >> MarginDeposit is the amount paid by the trader when entering
> given
> > > > futures position.
> > > >> Depending on instrument you are trading margin deposit can be
> > dynamic (
> > > >> when expressed as FRACTION of price) or constant.
> > > >>
> > > >> In your formula you have specifically decided to use CONSTANT
> > > > margin, using this line:
> > > >> MarginDeposit = 2500;
> > > >>
> > > >> That's why I said - the price does not matter, because you have
> > > > choosen to use
> > > >> STATIC deposit that does not vary with price.
> > > >>
> > > >> If you wish to use dynamic margin, you should define it
> > accordingly.
> > > >> You can use actual dynamic number or percentage. To use
> percentage
> > -
> > > > use negative numbers
> > > >> For example
> > > >> MarginDeposit = -10;
> > > >> means that margin is 10% of contract price.
> > > >>
> > > >> (again please look at:
> > > > http://www.amibroker.com/guide/h_futbacktest.html - it is all
> > > > described there)
> > > >>
> > > >> There is no substitute to re-reading the manual if in doubt. If
> you
> > > > have any trouble
> > > >> please use SUPPORT, not this list. He is very keen to answer
> any of
> > > > your questions / troubles.
> > > >>
> > > >> Sorry but I am pretty busy and I am here on this list from time
> to
> > > > time only and only for "public interest" things.
> > > >> My task is NOT to do individual user support. It is Marcin
> task, so
> > > > please use support at amibroker.com
> > > >> My tasks are:
> > > >> a) developing the program
> > > >> b) analysing and planning future development
> > > >> c) writing docs
> > > >> d) maintaing web pages
> > > >> e) writing articles for KB/ Stocks&Commodities
> > > >> f) other task involved with running business on everyday basis
> > > >>
> > > >> Best regards,
> > > >> Tomasz Janeczko
> > > >> amibroker.com
> > > >> ----- Original Message -----
> > > >> From: ozzyapeman
> > > >> To: amibroker@xxxxxxxxxxxxxxx
> > > >> Sent: Thursday, January 22, 2009 5:09 AM
> > > >> Subject: [amibroker] Re: How to force Backtester to Calculate
> > > > Position Size on Open Price?
> > > >>
> > > >>
> > > >> Tomasz - I just read this post, and I am now royally
> confused. I
> > > > will chalk it up to my brain being slow, but please indulge me
> once
> > > > more...
> > > >>
> > > >> First, I am backtesting Intraday, not EOD, so time stamps are
> > > > relevant.
> > > >>
> > > >> Secondly, how can the entry price *not matter* even if I am
> in
> > > > FUTURES mode?
> > > >>
> > > >> To simulate real trading, shouldn't the backtester apply the
> > > > margin deposit *dynamically*, according to the fluctuating
> price?
> > > >>
> > > >> For example:
> > > >>
> > > >> If IB allows FOREX trading at 40:1 margin, and I am trading
> > > > EUR.USD, then in order to buy 1 share (100,000 EUR) I only need
> to
> > pay
> > > > for 2,500 EUR.
> > > >>
> > > >> In order to Buy 2,500 EUR on 1/3/2008 @ 23:59, the Open
> price
> > > > was 1.2840
> > > >>
> > > >> therefore, $3,210.00 USD (2,500 * 1.2840) must be deducted
> from
> > my
> > > > IB cash account in order to Buy the 2,500 EUR.
> > > >>
> > > >> And after buying, my Position Value is $3,143.50 at the Close
> of
> > > > the bar (this latter part I now understand).
> > > >>
> > > >> How can you say that the price of buying 100,000 EUR is
> always
> > > > fixed at $2,500 USD no matter how the EUR.USD price fluctuates?!
> How
> > > > could that simulate a realistic backtest?!
> > > >>
> > > >> Anyone else, please feel free to chime in too. I am either
> > totally
> > > > confused on how the backteter works with Forex or something is
> being
> > > > lost in translation.
> > > >>
> > > >> A bit depressing if I have actually been doing all my
> backtesting
> > > > wrong for the past four months. And if that's the case, I need
> to
> > > > understand this once and for all.
> > > >>
> > > >>
> > > >>
> > > >> --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko" <groups@>
> > wrote:
> > > >> >
> > > >> > Hello,
> > > >> >
> > > >> > You are completely missing the point and mix up things.
> > > >> >
> > > >> > First: the timestamp - if you backtest on EOD data, the
> time
> > > > component does not matter (should be ignored),
> > > >> > because the EOD bar timestamp depends on data source
> delivering
> > > > data.
> > > >> > If you use true EOD data, it will be without time component
> at
> > all.
> > > >> > If you are using compressed intraday data it will use
> timestamp
> > > > that is either beginning or end
> > > >> > of interval based on Preferences Tools->Preferences-
> >Intraday
> > > > "Timestamp ... shows:".
> > > >> > Anyway, the time component does not matter if you backest
> EOD
> > > > system and solely depends
> > > >> > on how data source time stamps bars, and has no indication
> when
> > > > trade happened.
> > > >> >
> > > >> > Second: position sizing - you are using FUTURES mode. In
> > futures
> > > > mode when you defined
> > > >> > MarginDeposit, entry price does not matter ! Why? Because
> in
> > > > FUTURES mode you just pay
> > > >> > MARGIN DEPOSIT (i.e. $2500) in your case, regardless of
> current
> > > > price.
> > > >> > Since you also defined position size of ONE contract, the
> > > > position sizing DOES NOT depend
> > > >> > on Equity at all, since it will be JUST ONE contract.
> > > >> >
> > > >> >
> > > >> > MarginDeposit = 2500; // $2500 is required to enter that
> trade,
> > > > price of actual contract does NOT matter
> > > >> > in futures mode
> > > >> >
> > > >> > SetPositionSize(1, spsShares); // here you say to enter ONE
> > > > contract.
> > > >> >
> > > >> > So simply $2500 is taken from your account and you have 1
> > > > futures contract
> > > >> > open pos, regardless of account equity and any other
> > conditions.
> > > >> >
> > > >> > The price used TO ENTER this position was CORRECT OPEN
> price:
> > > >> >
> > > >> > "The prices on 11/3/2008 are as follows: Open = 1.2840"
> > > >> > 1.2840
> > > >> >
> > > >> >
> > > >> > So everything operates as it should
> > > >> >
> > > >> > The EXIT was on 11/4/2008 (not 11/3) therefore data from
> 11/3
> > > > are irrelevant for the exit.
> > > >> > The OPEN price for 11/4/2008 apparently is 1.2574 so the
> exit
> > is
> > > > at that price. Again as it should be.
> > > >> >
> > > >> > Best regards,
> > > >> > Tomasz Janeczko
> > > >> > amibroker.com
> > > >> > ----- Original Message -----
> > > >> > From: ozzyapeman
> > > >> > To: amibroker@xxxxxxxxxxxxxxx
> > > >> > Sent: Thursday, January 22, 2009 1:13 AM
> > > >> > Subject: [amibroker] Re: How to force Backtester to
> Calculate
> > > > Position Size on Open Price?
> > > >> >
> > > >> >
> > > >> > Here is an explicit example.
> > > >> >
> > > >> > In addition to OPEN being set in the reserved variables
> below,
> > > > OPEN is also set for all trade prices in AA settings:
> > > >> >
> > > >> >
> > > >> > //
> > > >
> > --------------------------------------------------------------------
> ---
> > > >> > // BACKTESTER SETTINGS
> > > >> > //
> > > >
> > --------------------------------------------------------------------
> ---
> > > >> >
> > > >> > SetBarsRequired(10000, 0);
> > > >> > SetOption("AllowPositionShrinking", False);
> > > >> > SetOption("AllowSameBarExit", True);
> > > >> > SetOption("CommissionAmount", 3.00);
> > > >> > SetOption("CommissionMode", 3);
> > > >> > SetOption("FuturesMode", 1);
> > > >> > SetOption("InitialEquity", 100000);
> > > >> > SetOption("InterestRate",0);
> > > >> > SetOption("MaxOpenPositions", 1);
> > > >> > SetOption("MinPosValue", 0);
> > > >> > SetOption("MinShares", 1);
> > > >> > SetOption("PriceBoundChecking", False );
> > > >> > SetOption("ReverseSignalForcesExit", False);
> > > >> > SetOption("UsePrevBarEquityForPosSizing", False );
> > > >> > SetTradeDelays(0, 0, 0, 0);
> > > >> > SetPositionSize(1, spsShares);
> > > >> > TickSize = 0.0001; // The minimum price move of symbol for
> > Forex
> > > >> > PointValue = 100000;
> > > >> > RoundLotSize = 1;
> > > >> > MarginDeposit = 2500;
> > > >> > BuyPrice = SellPrice = ShortPrice = CoverPrice = Open;
> > > >> >
> > > >> >
> > > >> > //
> > > >
> > --------------------------------------------------------------------
> ---
> > > >> > // SIMPLE TRADING SYSTEM
> > > >> > //
> > > >
> > --------------------------------------------------------------------
> ---
> > > >> >
> > > >> > fast = Optimize( "fast", 3, 5, 10, 1 );
> > > >> > slow = Optimize( "slow", 6, 10, 15, 1 );
> > > >> >
> > > >> > Buy = Cross( MACD( fast, slow ), Signal( fast, slow ) );
> > > >> > Sell = Cross( Signal( fast, slow ), MACD( fast, slow ) );
> > > >> >
> > > >> > Short = Sell;
> > > >> > Cover = Buy;
> > > >> >
> > > >> >
> > > >> > Backtesting the above on EUR.USD for 11/01/2008 -
> 12/01/2008
> > > > gives the following result ( I will just paste the first line):
> > > >> >
> > > >> > Ticker Trade Date Price
> > > >> > EURUSD Short 11/3/2008 23:59 1.284
> > > >> >
> > > >> >
> > > >> > Ex. date Ex. Price % chg Profit
> > > >> > 11/4/2008 23:59 1.2575 -2.06% 3326.11
> > > >> >
> > > >> >
> > > >> > % Profit Contracts Position value Cum. Profit
> > > >> > 105.81% 1 3143.5 3326.11
> > > >> >
> > > >> >
> > > >> > # bars Profit/bar MAE MFE Scale In/Out
> > > >> > 2 1663.06 -0.47% 2.45% 0/0
> > > >> >
> > > >> >
> > > >> > The prices on 11/3/2008 are as follows:
> > > >> >
> > > >> > Open = 1.2840
> > > >> > Low = 1.2525
> > > >> > High = 1.2900
> > > >> > Close = 1.2574
> > > >> >
> > > >> >
> > > >> > If you reverse the Position Value, based on 40:1 leverage,
> you
> > > > find that it was calculated on a price of 1.2574, which is the
> > CLOSE:
> > > >> >
> > > >> > $3,143.50 * 40 / 100000 = 1.2574
> > > >> >
> > > >> >
> > > >> >
> > > >> >
> > > >> >
> > > >> >
> > > >> > --- In amibroker@xxxxxxxxxxxxxxx, "ozzyapeman" zoopfree@
> wrote:
> > > >> > >
> > > >> > > I should note that for Entry prices, the backtester is
> > > > correctly using
> > > >> > > OPEN prices and for ApplyStop, it is correctly exiting at
> the
> > > > right
> > > >> > > price point between LOW and HIGH.
> > > >> > >
> > > >> > > It is only for the position values that the backtester is
> > > > using CLOSE
> > > >> > > prices to calculate, even though CLOSE is nowhere in my
> AA
> > > > settings or
> > > >> > > AFL reserved variables or SetOptions.
> > > >> > >
> > > >> > >
> > > >> > > --- In amibroker@xxxxxxxxxxxxxxx, "ozzyapeman" zoopfree@
> > wrote:
> > > >> > > >
> > > >> > > > Tomasz,
> > > >> > > >
> > > >> > > > Thanks for the reply, but I *did* read the manual and
> *did*
> > > > set the
> > > >> > > > buyprice reserved variables, etc. (all to OPEN), and
> yet
> > the
> > > >> > > > backtester is still using CLOSE for position value
> > calculations.
> > > >> > > >
> > > >> > > > Hence I posted the question.
> > > >> > > >
> > > >> > > > So either this is a bug or there is some other setting
> > which is
> > > >> > > > overriding both my AA settings and reserved variable
> > > > settings. I can't
> > > >> > > > seem to find any such setting error, so at this point I
> am
> > > > thinking
> > > >> > > > it's a bug.
> > > >> > > >
> > > >> > > > Is it?
> > > >> > > >
> > > >> > > >
> > > >> > > >
> > > >> > > > --- In amibroker@xxxxxxxxxxxxxxx, "Tomasz Janeczko"
> > > > <groups@> wrote:
> > > >> > > > >
> > > >> > > > > Hello,
> > > >> > > > >
> > > >> > > > > When everything fails consult..... the manual:
> > > >> > > > >
> > > >> > > > > http://www.amibroker.com/guide/h_backtest.html
> > > >> > > > >
> > > >> > > > > Quote
> > > >> > > > >
> > > >> > > > > "Controlling trade price
> > > >> > > > >
> > > >> > > > > AmiBroker now provides 4 new reserved variables for
> > > > specifying the
> > > >> > > > price at which buy, sell, short and cover orders are
> > executed.
> > > >> > > > > These arrays have the following names: buyprice,
> > sellprice,
> > > >> > > > shortprice and coverprice.
> > > >> > > > >
> > > >> > > > > The main application of these variables is
> controlling
> > > > trade price:
> > > >> > > > >
> > > >> > > > > BuyPrice = IIF( dayofweek() == 1, HIGH, CLOSE );
> > > >> > > > > // on monday buy at high, otherwise buy on close
> > > >> > > > >
> > > >> > > > > So you can write the following to simulate real
> > stop-orders:
> > > >> > > > >
> > > >> > > > > BuyStop = ... the formula for buy stop level;
> > > >> > > > > SellStop = ... the formula for sell stop level;
> > > >> > > > >
> > > >> > > > > // if anytime during the day prices rise above
> buystop
> > level
> > > >> > > > (high>buystop)
> > > >> > > > > // the buy order takes place (at buystop or low
> whichever
> > > > is higher)
> > > >> > > > > Buy = Cross( High, BuyStop );
> > > >> > > > >
> > > >> > > > > // if anytime during the day prices fall below
> sellprice
> > > > level ( low
> > > >> > > > < sellstop )
> > > >> > > > > // the sell order takes place (at sellstop or high
> > > > whichever is lower)
> > > >> > > > > Sell = Cross( SellPrice, SellStop);
> > > >> > > > >
> > > >> > > > > BuyPrice = max( BuyStop, Low ); // make sure buy
> price
> > not
> > > > less
> > > >> > > than Low
> > > >> > > > > SellPrice = min( SellStop, High ); // make sure sell
> > price not
> > > >> > > > greater than High
> > > >> > > > >
> > > >> > > > > Please note that AmiBroker presets buyprice,
> sellprice,
> > > > shortprice
> > > >> > > > and coverprice array variables with the values defined
> in
> > > > system
> > > >> > > > > test settings window (shown below), so you can but
> don't
> > > > need to
> > > >> > > > define them in your formula. If you don't define them
> > AmiBroker
> > > >> > > > > works as in the old versions.
> > > >> > > > >
> > > >> > > > > During back-testing AmiBroker will check if the
> values
> > you
> > > > assigned
> > > >> > > > to buyprice, sellprice, shortprice, coverprice fit into
> > > > high-low
> > > >> > > > > range of given bar. If not, AmiBroker will adjust it
> to
> > > > high price
> > > >> > > > (if price array value is higher than high) or to the
> low
> > price
> > > >> > > > > (if price array value is lower than low)"
> > > >> > > > >
> > > >> > > > > Best regards,
> > > >> > > > > Tomasz Janeczko
> > > >> > > > > amibroker.com
> > > >> > > > > ----- Original Message -----
> > > >> > > > > From: "ozzyapeman" <zoopfree@>
> > > >> > > > > To: amibroker@xxxxxxxxxxxxxxx
> > > >> > > > > Sent: Wednesday, January 21, 2009 10:46 PM
> > > >> > > > > Subject: [amibroker] Re: How to force Backtester to
> > Calculate
> > > >> > > > Position Size on Open Price?
> > > >> > > > >
> > > >> > > > >
> > > >> > > > > > and here are all my other options set in the AFL.
> > > >> > > > > >
> > > >> > > > > > I can't see how any of them would force the
> backtester
> > > > to use Close
> > > >> > > > > > prices, but maybe one option does?
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > > SetBarsRequired( 10000, 0 );
> > > >> > > > > > SetOption( "AccountMargin", 100 );
> > > >> > > > > > SetOption( "ActivateStopsImmediately", True );
> > > >> > > > > > SetOption( "AllowPositionShrinking", False );
> > > >> > > > > > SetOption( "AllowSameBarExit", True );
> > > >> > > > > > SetOption( "CommissionAmount", 3.00 );
> > > >> > > > > > SetOption( "CommissionMode", 2 );
> > > >> > > > > > SetOption( "FuturesMode", 1 );
> > > >> > > > > > SetOption( "InitialEquity", 100000 );
> > > >> > > > > > SetOption( "InterestRate", 0 );
> > > >> > > > > > SetOption( "MaxOpenPositions", 1 );
> > > >> > > > > > SetOption( "MinPosValue", 0 );
> > > >> > > > > > SetOption( "MinShares", 1 );
> > > >> > > > > > SetOption( "PriceBoundChecking", True );
> > > >> > > > > > SetOption( "ReverseSignalForcesExit", False );
> > > >> > > > > > SetOption( "UsePrevBarEquityForPosSizing", False );
> > > >> > > > > > SetTradeDelays( 0, 0, 0, 0 );
> > > >> > > > > > SetPositionSize( 1, spsShares );
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > > --- In amibroker@xxxxxxxxxxxxxxx, "ozzyapeman"
> > > > <zoopfree@> wrote:
> > > >> > > > > >>
> > > >> > > > > >> Buyprices set in AFL formula are all Open:
> > > >> > > > > >>
> > > >> > > > > >> BuyPrice = Open;
> > > >> > > > > >> ShortPrice = Open;
> > > >> > > > > >> SellPrice = Open;
> > > >> > > > > >> CoverPrice = Open;
> > > >> > > > > >>
> > > >> > > > > >> very wierd...
> > > >> > > > > >>
> > > >> > > > > >>
> > > >> > > > > >> --- In amibroker@xxxxxxxxxxxxxxx, "Anthony
> Faragasso"
> > > > <ajf1111@>
> > > >> > > > wrote:
> > > >> > > > > >> >
> > > >> > > > > >> > Is there anywhere in your code formula that you
> may
> > be
> > > >> > > specifying a
> > > >> > > > > >> different buyprice....because I believe the
> formula
> > > > overrides the
> > > >> > > > > >> settings in the preference window..
> > > >> > > > > >> >
> > > >> > > > > >> > Anthony
> > > >> > > > > >> >
> > > >> > > > > >> >
> > > >> > > > > >> > ----- Original Message -----
> > > >> > > > > >> > From: ozzyapeman
> > > >> > > > > >> > To: amibroker@xxxxxxxxxxxxxxx
> > > >> > > > > >> > Sent: Wednesday, January 21, 2009 3:41 PM
> > > >> > > > > >> > Subject: [amibroker] Re: How to force Backtester
> to
> > > > Calculate
> > > >> > > > > >> Position Size on Open Price?
> > > >> > > > > >> >
> > > >> > > > > >> >
> > > >> > > > > >> > I've always had the trade settings set to
> buyprice
> > Open.
> > > >> > > > > >> >
> > > >> > > > > >> > Unfortunately, the backtester insists on using
> the
> > > > Close, and I
> > > >> > > > > > can't
> > > >> > > > > >> > figure out why that is.
> > > >> > > > > >> >
> > > >> > > > > >> > --- In amibroker@xxxxxxxxxxxxxxx, "gonzagags"
> > > > <gonzagags@>
> > > >> > > wrote:
> > > >> > > > > >> > >
> > > >> > > > > >> > > Try in settings- trades, set in long trades
> > buyprice in
> > > >> > > open..
> > > >> > > > > >> > >
> > > >> > > > > >> > >
> > > >> > > > > >> > > --- In amibroker@xxxxxxxxxxxxxxx, "ozzyapeman"
> > > > <zoopfree@>
> > > >> > > > wrote:
> > > >> > > > > >> > > >
> > > >> > > > > >> > > > Hello, even though I have set Buyprice =
> Open; I
> > > > noticed
> > > >> > > > > > that the
> > > >> > > > > >> > > > backtester report is displaying position
> sizes
> > > > based on the
> > > >> > > > > >> Close of
> > > >> > > > > >> > > > the bar. On some trades this makes a huge
> > difference.
> > > >> > > > > >> > > >
> > > >> > > > > >> > > > I am backtesting Forex. And I imagine that
> when
> > > > trading
> > > >> > > > on the
> > > >> > > > > >> Open,
> > > >> > > > > >> > > a
> > > >> > > > > >> > > > broker like IB will use the dynamic price of
> the
> > > > Open to
> > > >> > > > > >> calculate
> > > >> > > > > >> > > the
> > > >> > > > > >> > > > exchange rate and position size, since the
> Close
> > > > price is
> > > >> > > > > > not yet
> > > >> > > > > >> > > > known at the time of the trade.
> > > >> > > > > >> > > >
> > > >> > > > > >> > > > So how do I force the backtester to mimic
> the
> > > > above, and
> > > >> > > > > > calculate
> > > >> > > > > >> > > > position sizes based on Opens? Or is this
> not
> > even an
> > > >> > > option?
> > > >> > > > > >> > > >
> > > >> > > > > >> > > > I looked up Setoption in the reference
> guide,
> > and
> > > > don't
> > > >> > > seem
> > > >> > > > > >> to see
> > > >> > > > > >> > > an
> > > >> > > > > >> > > > appropriate setting to switch.
> > > >> > > > > >> > > >
> > > >> > > > > >> > > > Any input appreciated.
> > > >> > > > > >> > > >
> > > >> > > > > >> > >
> > > >> > > > > >> >
> > > >> > > > > >> >
> > > >> > > > > >> >
> > > >> > > > > >> >
> > > >> > > > > >> >
> > > >> > > > > >> >
> > > >> > > > > >> >
> > > >> > > > > >>
> > > >> > > > > >
> > > >> > > >
> > > >> > >
> > > >
> > --------------------------------------------------------------------
> ----\
> > ------
> > > >> > > > > >> >
> > > >> > > > > >> >
> > > >> > > > > >> >
> > > >> > > > > >> > No virus found in this incoming message.
> > > >> > > > > >> > Checked by AVG - http://www.avg.com
> > > >> > > > > >> > Version: 8.0.176 / Virus Database:
> 270.10.10/1906 -
> > > > Release
> > > >> > > Date:
> > > >> > > > > >> 1/21/2009 7:07 AM
> > > >> > > > > >> >
> > > >> > > > > >>
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > > ------------------------------------
> > > >> > > > > >
> > > >> > > > > > **** IMPORTANT ****
> > > >> > > > > > This group is for the discussion between users
> only.
> > > >> > > > > > This is *NOT* technical support channel.
> > > >> > > > > >
> > > >> > > > > > *********************
> > > >> > > > > > TO GET TECHNICAL SUPPORT from AmiBroker please send
> an
> > > > e-mail
> > > >> > > > directly to
> > > >> > > > > > SUPPORT {at} amibroker.com
> > > >> > > > > > *********************
> > > >> > > > > >
> > > >> > > > > > For NEW RELEASE ANNOUNCEMENTS and other news always
> > > > check DEVLOG:
> > > >> > > > > > http://www.amibroker.com/devlog/
> > > >> > > > > >
> > > >> > > > > > For other support material please check also:
> > > >> > > > > > http://www.amibroker.com/support.html
> > > >> > > > > >
> > > >> > > > > > *********************************
> > > >> > > > > > Yahoo! Groups Links
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > >
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > > >
> > > >
> > > >
> > > > ------------------------------------
> > > >
> > > > **** IMPORTANT ****
> > > > This group is for the discussion between users only.
> > > > This is *NOT* technical support channel.
> > > >
> > > > *********************
> > > > TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail
> > directly to
> > > > SUPPORT {at} amibroker.com
> > > > *********************
> > > >
> > > > For NEW RELEASE ANNOUNCEMENTS and other news always check
> DEVLOG:
> > > > http://www.amibroker.com/devlog/
> > > >
> > > > For other support material please check also:
> > > > http://www.amibroker.com/support.html
> > > >
> > > > *********************************
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > >
> >
>
------------------------------------
**** IMPORTANT ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
*********************
TO GET TECHNICAL SUPPORT from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
*********************
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
For other support material please check also:
http://www.amibroker.com/support.html
*********************************
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/amibroker/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/amibroker/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:amibroker-digest@xxxxxxxxxxxxxxx
mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx
<*> To unsubscribe from this group, send an email to:
amibroker-unsubscribe@xxxxxxxxxxxxxxx
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|