Welcome to the Traders Laboratory.

Tools of the Trade Discussion forum for software, hardware, and computer related topics

Like Tree2Likes
  • 2 Post By bharatk8
Reply
Old 07-04-2013, 09:07 PM   #1

Join Date: Mar 2009
Location: ahmedabad
Posts: 39
Ignore this user

Thanks: 5
Thanked 11 Times in 10 Posts

Required Backtesting Simulator AFL......

I am looking for a backtesting simulator mentioned here,

http://etoke.wordpress.com/2009/04/1...lated-trading/

If you have AFL similar to this one,pl. share.
bharatk8 is offline  
Reply With Quote
Old 07-05-2013, 02:37 AM   #2

Status: Super Moderator
Join Date: Jul 2013
Posts: 948
Ignore this user

Thanks: 45
Thanked 61 Times in 57 Posts

Re: Required Backtesting Simulator AFL......

hi there........the link you provided is no good so you might give us another one so that we can have an idea about what you mean
tradingwizzard is offline  
Reply With Quote
The Following User Says Thank You to tradingwizzard For This Useful Post:
bharatk8 (07-05-2013)
Old 07-05-2013, 03:07 AM   #3

Join Date: Mar 2009
Location: ahmedabad
Posts: 39
Ignore this user

Thanks: 5
Thanked 11 Times in 10 Posts

Re: Required Backtesting Simulator AFL......

Simulated Trading | eToke's Blog

Simulated Trading 19apr09
I am very excited today as I have managed to complete something which has been on my to-do list for a very, very long time.

A final push of inspiration from Dr. Brett’s new book, The Daily Trading Coach has allowed me to code up a simulator for my current Amibroker Setup.

My issue with Simulated Trading in the past is simple: Using a demo account has an opportunity cost: It can only be used during market hours and I just cannot afford the time to spend actual market time in simulation mode. Ideally I want to be able to play-back many market hours of data during weekends and nights where I can practice my trading and ideas without wasting the little exposure to actual market time that I have.

Amibroker has a great playback feature, which I have used for this purpose. An added bonus is the ability to playback at faster speeds in order to intensify and shorten the simulated session.

I will touch on how I trade both automated system and discretionarily, in detail in later posts, but for now, I will simply say that I have up to now traded my (actual) discretionary trades on TWS through my Amibroker charts.

Basically I have 5 buttons. In the past these have only fired orders in TWS. Now the chart can be switched to simulation mode where they create simulated orders :

Complete Order: This will place a bracket order in TWS based on 3 horizontal “studďes” (lines on the chart which you can drag up and down in order to adjust the price level) – an entry, a stop and a target.

Cancel: Will cancel any pending orders for the current symbol.

Attach Bracket: Will attach a bracket order to the existing postion. Will do nothing if there is no open position.

Buy and Sell: These will place a limit order at the last price traded. Have a small probability of not being executed, but I prefer it this way than having to pay the bid-ask spread. Pressing these buttons more than once in one direction will pyramid a trade.

Close: Closes the current position. Will do nothing if there is no open position.

Today I have done the following improvements to my existing code:

1 – I have finally taken the plunge to learn how GFX (Graphics programming on charts) in Amibroker works, and replaced the buttons (which used to be in the parameters window – Amibroker users will understand what I mean here). This is a great saver for screen real estate.

2 – I have added some code which will allow simulated trading. This works as follows:

1. The code will write each transaction (triggered by the buttons above) to a file identical in format to TWS’s executions.txt file.

2. An Excel Sheet (which I already have used for several years) reads this file and matches buys and sells together to create roundtrip trades and displays statistics.

3. The excel sheet also creates a “History file” in AFL which can be used to display past trades on the chart as well as be run in the backtester. This allows me to look at my trading performance using the metrics available in Amibroker.

Points 2 and 3 I already used for my actual trading, but now I can use them to score my sessions on the “simulator”.

Note: My position sizing is already coded into the system as a function of the ATR. I have learned not to mess about with position sizing a long time ago and nowadays my trading is simply a matter of pressing these buttons. The sizing changes depending on whether I am day trading or swing trading. This is set in the parameters window of the chart.

Here are some screen shots of the setup:

This is one of my charts. As indicated in my earlier post I have multiple timeframes on different charts at the same time. The control panel automatically appear only on the short term chart if I am trading using a day trade setup and position size or on the medium term chart when trading the swing setup and position size. The red and green dots indicate my simulated trades.



This is the spreadsheet which does the trade matching:



…and finally, here are the results for 11/09/2008 when run through the backtester:



I have not posted the code for this on the blog because it is currently all over the place and is not really well packaged for distribution, however if you are interested in the code I can email it to you “as is”, with no guarantees it would work on your system! Later on, once I neaten up things a little I will start posting some code too.

Feedback and comments would be very welcome!

go to blog to find more info.


Quote:
Originally Posted by tradingwizzard »
hi there........the link you provided is no good so you might give us another one so that we can have an idea about what you mean
winton and vss like this.
bharatk8 is offline  
Reply With Quote
The Following 2 Users Say Thank You to bharatk8 For This Useful Post:
vss (02-24-2016), winton (10-25-2015)
Old 01-19-2014, 08:37 PM   #4

Join Date: Mar 2009
Location: ahmedabad
Posts: 39
Ignore this user

Thanks: 5
Thanked 11 Times in 10 Posts

Re: Required Backtesting Simulator AFL......

bumping.................. ..........
Quote:
Originally Posted by bharatk8 »
Simulated Trading | eToke's Blog

Simulated Trading 19apr09
I am very excited today as I have managed to complete something which has been on my to-do list for a very, very long time.

A final push of inspiration from Dr. Brett’s new book, The Daily Trading Coach has allowed me to code up a simulator for my current Amibroker Setup.

My issue with Simulated Trading in the past is simple: Using a demo account has an opportunity cost: It can only be used during market hours and I just cannot afford the time to spend actual market time in simulation mode. Ideally I want to be able to play-back many market hours of data during weekends and nights where I can practice my trading and ideas without wasting the little exposure to actual market time that I have.

Amibroker has a great playback feature, which I have used for this purpose. An added bonus is the ability to playback at faster speeds in order to intensify and shorten the simulated session.

I will touch on how I trade both automated system and discretionarily, in detail in later posts, but for now, I will simply say that I have up to now traded my (actual) discretionary trades on TWS through my Amibroker charts.

Basically I have 5 buttons. In the past these have only fired orders in TWS. Now the chart can be switched to simulation mode where they create simulated orders :

Complete Order: This will place a bracket order in TWS based on 3 horizontal “studďes” (lines on the chart which you can drag up and down in order to adjust the price level) – an entry, a stop and a target.

Cancel: Will cancel any pending orders for the current symbol.

Attach Bracket: Will attach a bracket order to the existing postion. Will do nothing if there is no open position.

Buy and Sell: These will place a limit order at the last price traded. Have a small probability of not being executed, but I prefer it this way than having to pay the bid-ask spread. Pressing these buttons more than once in one direction will pyramid a trade.

Close: Closes the current position. Will do nothing if there is no open position.

Today I have done the following improvements to my existing code:

1 – I have finally taken the plunge to learn how GFX (Graphics programming on charts) in Amibroker works, and replaced the buttons (which used to be in the parameters window – Amibroker users will understand what I mean here). This is a great saver for screen real estate.

2 – I have added some code which will allow simulated trading. This works as follows:

1. The code will write each transaction (triggered by the buttons above) to a file identical in format to TWS’s executions.txt file.

2. An Excel Sheet (which I already have used for several years) reads this file and matches buys and sells together to create roundtrip trades and displays statistics.

3. The excel sheet also creates a “History file” in AFL which can be used to display past trades on the chart as well as be run in the backtester. This allows me to look at my trading performance using the metrics available in Amibroker.

Points 2 and 3 I already used for my actual trading, but now I can use them to score my sessions on the “simulator”.

Note: My position sizing is already coded into the system as a function of the ATR. I have learned not to mess about with position sizing a long time ago and nowadays my trading is simply a matter of pressing these buttons. The sizing changes depending on whether I am day trading or swing trading. This is set in the parameters window of the chart.

Here are some screen shots of the setup:

This is one of my charts. As indicated in my earlier post I have multiple timeframes on different charts at the same time. The control panel automatically appear only on the short term chart if I am trading using a day trade setup and position size or on the medium term chart when trading the swing setup and position size. The red and green dots indicate my simulated trades.



This is the spreadsheet which does the trade matching:



…and finally, here are the results for 11/09/2008 when run through the backtester:



I have not posted the code for this on the blog because it is currently all over the place and is not really well packaged for distribution, however if you are interested in the code I can email it to you “as is”, with no guarantees it would work on your system! Later on, once I neaten up things a little I will start posting some code too.

Feedback and comments would be very welcome!

go to blog to find more info.
bharatk8 is offline  
Reply With Quote
Old 02-24-2016, 01:21 PM   #5
vss

Join Date: Feb 2016
Posts: 1
Ignore this user

Thanks: 1
Thanked 0 Times in 0 Posts

Re: Required Backtesting Simulator AFL......

Hi BharatK8,

Please can you send me the code vss@finance.guru.

Thanks in advance.
vss is offline  
Reply With Quote
Old 01-04-2017, 03:26 PM   #6

Join Date: Oct 2015
Posts: 1
Ignore this user

Thanks: 1
Thanked 0 Times in 0 Posts

Re: Required Backtesting Simulator AFL......

Hello , If your Simulated Trading AFL is so convenient - why not demonstrate it and sell later to someone who prefers AB more than ForexTester ?
winton is offline  
Reply With Quote

Reply

Thread Tools
Display Modes Help Others By Rating This Thread
Help Others By Rating This Thread:

Similar Threads
Thread Thread Starter Forum Replies Last Post
ES Trading Simulator in Excel Clym E-mini Futures Trading Laboratory 6 11-05-2011 06:09 AM
Guidance Required nave Automated Trading 12 10-14-2010 02:46 AM
Point & Figure Simulator Tams Trading Indicators 5 12-06-2009 08:36 PM
Training with a Simulator RobinHood Beginners Forum 9 08-22-2008 11:21 AM
How much analysis is required as a trader? pierre Market Analysis 7 11-22-2006 05:32 PM

All times are GMT -4. The time now is 02:20 PM.
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
CS to VB integration by DeskLancer
©2006-2011 Traders Laboratory, All Rights Reserved.