Close a Position

Expand / Collapse
 

Close a Position


Close a Position Strategy


This strategy opens a buy position when the strategy starts, checks the NetP/L of the position, and closes the position when necessary.

The number of account, the history, the number of lots, trader range, desirable profit and critical loss are defined in the settings before starting the strategy:




 

Once the system gets a new feed on the open candle, the strategy checks the NetPL, and if it is bigger than the desirable level or too low, the position will be closed:






Rate this Download:

Download File


Close_Position.act Close_Position.act (2.13 KB, 1,442 views)

User Comments

Click to subscribe to comments RSS feed...
No Member Photo by florian posted Sunday, September 18, 2011
Sorry you don't have permission to rate comments. 0 Sorry you don't have permission to rate comments.
hi !!
just learnig actfx so I modifid the code to monitor what the parameters are doing.

procedure OnStart;
begin
    CreateOrder(History.Instrument,Account,Amount,bsBuy,NullRate,NullRate,TraderRange,'NewTrade');
    log (datetostr(date)+' '+timetostr(time));
    log ('Buy position opened: '+floattostr(History.Instrument.buy));
end;

that gives me :
23:18:25.264: 30/12/1899 00:00:00
23:18:25.267: Buy position opened: 1818.09
23:18:25.271: Strategy started
23:18:25.349: Position closed. Net P/L: 360930
23:18:30.975: Strategy stopped

anybody knows what is wrong ??
best regards 
florian


Comment require login or registration.

Details
Type: SCRIPT

Article has been viewed 4,367 times.

Options