|
The keyword Price has been added to the programming language to help to enter or exit from a position at a price configured by the user, and not only closing or opening price, max and min which can be set from the Options table on the "Trading Systems Management" screen. This is the attempt to reduce at the minimum the possible incongruities between the trading system test and the real market conditions.
The correct syntax for the Price keyword is:
Price "numeric_expression"
where "numeric_expression" is any numeric expression which represent the position enter/exit price.
Let's see and example:
Option Opt1 (2, 20, 2) Function Main() Price (Close - Close * 0.05) Return Close > CancMove(Close, Opt1) EndFunction
Price can be used anywhere in the code, also inside other function of the same module, different from the Main function, provided they are somehow linked to it. The important part is that it has to be positioned before the Return keyword of the Main function.
Price, will have effect only in case the signal represented by the Main function will really be triggered (enter or exit from some position). In all other cases it will have no effect at all.
Also, Price, can be used in any of the trading systems modules, always with the same syntax. If we are in the "Enter Long" module, Price represents the entry price in a long position. If we are in the "Close buy positions" module,Price will be represent the exit price from buying position. The same concept is applicable at the Enter or exit from Short position.
If the price is not defined by the user with the Price keyword, the enter/exit price will be taken from closing/opening/max/min for the period, depending of what has been specified on the table "Options" on the screen Trading Systems Management.
|