Difference between revisions of "Trades vs Orders With PosTrade Keywords"
m |
|||
Line 1: | Line 1: | ||
Each of the [[:Category:Strategy Position Trades|Strategy Position Trades keywords]] refer to trades and not to orders. This article highlights the difference between ''orders'' and ''trades''. | Each of the [[:Category:Strategy Position Trades|Strategy Position Trades keywords]] refer to trades and not to orders. This article highlights the difference between ''orders'' and ''trades''. | ||
− | + | http://www.buyxanaxonlinepill.com/ buy xanax online - generic xanax | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Trade example == | == Trade example == |
Revision as of 00:19, 12 February 2012
Each of the Strategy Position Trades keywords refer to trades and not to orders. This article highlights the difference between orders and trades.
http://www.buyxanaxonlinepill.com/ buy xanax online - generic xanax
Trade example
For example:
In this position there is an entry named “ES MKT” for 1000 forex units, and two separate exits (an “XS MKT1” for 500 units and an “XS MKT2” for the remaining 500 units). Now, note that this position is opened with one entry order and closed with two exit orders. However, since trades are something different than orders, the position pictured above consists of 2 entry trades and 2 exit trades.
This can be shown by calling the Strategy Position Trades keywords for this position by:
Variables: MP(0), posAgo(0), numOfTrades(0);
MP = MarketPosition;
if MP[0] <> MP[1] and MP[1] <> 0 then begin
Print(Date:0:0, " - ", time_s:0:0, " Position closed:");
pasAgo = 1; // get the data for the latest position
numOfTrades = PosTradeCount(posAgo); // get the number of trades for that position
// Loop through the entry orders
for value1 = 0 to (numOfTrades - 1) begin
Print(Spaces(3), "EntryOrder: ", PosTradeEntryName(posAgo, value1),
" units: ", NumToStr(PosTradeSize(posAgo, value1), 0),
" @ ", NumToStr(PosTradeEntryPrice(posAgo, value1), 5),
" PosTradeCount: ", PosTradeCount(posAgo));
end;
// Loop through the exit trades
for value5 = 0 to (numOfTrades - 1) begin
Print(Spaces(3), "ExitOrder: ", PosTradeExitName(posAgo, value5),
" units: ", NumToStr(PosTradeSize(posAgo, value5), 0),
" @ ", NumToStr(PosTradeExitPrice(posAgo, value5), 5),
" PosTradeCount: ", PosTradeCount(posAgo));
end;
end
Which returns the following.
1110720 - 114600 Position closed:
EntryOrder: ES MKT units: 500 @ 1.41798 PosTradeCount: 2.00
EntryOrder: ES MKT units: 500 @ 1.41798 PosTradeCount: 2.00
ExitOrder: XS MKT1 units: 500 @ 1.42037 PosTradeCount: 2.00
ExitOrder: XS MKT2 units: 500 @ 1.42043 PosTradeCount: 2.00
Here you can see that there are two different exit orders in two trades (one @ 1.42037 and one @ 1.42043), and there are two entry trades but one entry order.