Adding Manual Test Signals

Testing real-time trading systems and waiting for price changes to trigger a signal can be quite tedious. You can speed up your testing by inserting the code listed below between your system and automation code. This will enable you to interject manual signals without having to wait for real-time signals.

This code is intended to facilitate testing; however, it can also be used to add discretionary control to your system. To prevent signal conflicts and strange system behaviour, a Disable/Enable Auto Trades control is provided that disables real-time signals during testing.

In this example, the signals are transformed into Binary True/False signals for the last bar. This will come in handy when, later in the code, you want to save signals in Static Variables (they do not accept arrays).

1
2
3
4
5
6
7
8
9
10
11
// Buy, Sell, Short, and Cover must be defined before this point 
DisableAutoTrades = ParamToggle("Auto Trades","DISABLED|ENABLED",0); 
if( DisableAutoTrades ) Buy = Sell = Short = Cover = 0; 
ManualBuy = ParamTrigger("Manual Buy","BUY"); 
ManualSell = ParamTrigger("Manual Sell","SELL"); 
ManualShort = ParamTrigger("Manual Short","SHORT"); 
ManualCover = ParamTrigger("Manual Cover","COVER"); 
LastBuy = LastValue(Buy) OR MAnualBuy; 
LastSell = LastValue(Sell) OR MAnualSell; 
LastShort = LastValue(Short) OR ManualShort; 
LastCover = LastValue(Cover) OR MAnualCover;

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 2 out of 5)
Loading ... Loading ...

No comments yet. Be the first.

Leave a reply