AFL Programming

I am having list of scripts in a following formats for each day as follows:-

Ticker Date/Time Entry Price Buy/Sell b u y S e L LOT
ABC 17-08-2018 12:59 1568 1 0 400
xxyz 17-08-2018 12:14 2662.4 0 1 250

I want AFL which will calculate the profit/ loss made in a particular day. The position will be squared of if certain stop loss is triggerd after the entry is taken. The result should show the

  1. profit/loss at the end of day on the basis of Entry Price after taken into consideration the stop Loss

  2. profit/loss at the end of day on the basis of Entry Price after taken into consideration NO Stop Loss is place

@SHANTVCI

Your AFL code will need to define entry and exits , stop criteria and position size. Create a watch list with your trade universe and run a back test for your date range of interest and this will generate a p/l for you.

Otherwise you need to hard code every trade in afl and in this case you may as well use a spreadsheet.

Read the manual look at the knowledge base and search this forum you will find many examples of how to write code to achieve what you want.

Howard Brandy’s books are also an excellent resource.

1 Like

Thanks a lot for input

To give you a starting point search for beans.afl in the afl library by author Ken Chase.
You will have to substitute your trade info into it and apply the afl to a chart and it will display profit and loss for current day in tabular form.

1 Like

ok. I shall try this. Thanks for sharing .

Sorry author above should read Ken Close.