Characteristics of a good AFL code

Characteristics of a good AFL code

  • Declared variables Buy/Sell/Short/Cover and assigned correct logic’s
  • Declared variables BuyPrice/SellPrice/ShortPrice/CoverPrice and assigned correct values. (Assigning wrong price value will give wrong back-test results)
  • Buy/Sell/Short/Cover signal comes at the last bar (If no signal at last bar, then If (LastValue(Buy)) will fail, hence no order firing)
  • No Repeat of same Signals (Use Exrem to remove excess signals)
  • Signal does not repaint (If your signal logic uses ‘Close’, then it will repaint. Most of the AFL codes available in the internet uses ‘Close’)
  • Signal logic does not uses future bars i.e. false signals (Some alleged developers uses this to cheat people, using future bars will give huge profit in back test, but in reality, you will never get signal in real-time)
  • No entry and exit signal at same bar(very critical issue. Your Sell logic should also include Buy==0, and Cover logic include Short==0)
  • Each Entry signal has corresponding Exit signal
  • Open signals are properly closed at Square off (in case of Intraday systems)
  • Exit signal is not generated first. (Use conditional Exrem to remove invalid Sell/Cover signals)

Bridge code will work good as long as your AFL code generates valid and error free signals.

Your Buy/Sell/Short/Cover logic and Bridge code are independent of each other. You need to call the required Bridge functions in your AFL code at the right place and at the right time. Bridge code will not alter your signals, it will just place a corresponding Entry/Exit order as per the symbol details passed whenever you get signal in your AFL code.

Some Parameters/Variables in our Bridge code has to be modified as per your Trading System.

Was this article helpful?

Related Articles

Leave A Comment?