Difference between revisions of "PlaceMarketOrder"

From MultiCharts
Jump to navigation Jump to search
m
 
(4 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Places market order at the broker without position changing on the chart.  
+
Places a market order at the broker immediately after the script calculation without position changing on the chart.  
 
   
 
   
==== Usage ====
+
== Usage ==
 
<syntaxhighlight>PlaceMarketOrder(IsBuy, IsEntry, Contracts)</syntaxhighlight>  
 
<syntaxhighlight>PlaceMarketOrder(IsBuy, IsEntry, Contracts)</syntaxhighlight>  
  
Line 12: Line 12:
 
:'''Contracts''' - indicates the number of contracts/shares of the order.  
 
:'''Contracts''' - indicates the number of contracts/shares of the order.  
 
   
 
   
==== Notes ====  
+
== Notes ==
Works with auto trading turned off. Can be used as a mean of synchronization of strategy market position with a broker.  
+
* Works only with auto trading turned on.  
+
* Can be used as a mean of synchronization of strategy market position with a broker.  
==== Example ====  
+
* Also see the related [[ChangeMarketPosition]] keyword.
<syntaxhighlight>If MarketPosition = 2 then  
+
 
  PlaceMarketOrder (true, true, 2); </syntaxhighlight>
+
== Example ==
 +
<syntaxhighlight>If MarketPosition*CurrentContracts = 2 and MarketPosition_at_Broker = 4 then PlaceMarketOrder (false, false, 2); </syntaxhighlight>
 +
 
 +
Will generate sell market order for 2 contracts to synchronize market position at broker with the strategy position.
  
Will place buy market order for 2 contracts if current MarketPosition = 2.  
+
Please refer to [[Trading_from_Multiple_Charts_on_One_Instrument#.21From_Strategy_To_Broker_MP_Synchronizer.21|!From Strategy To Broker MP Synchronizer!]] default signal for more examples.  
 
   
 
   
  

Latest revision as of 10:17, 23 April 2021

Places a market order at the broker immediately after the script calculation without position changing on the chart.

Usage

PlaceMarketOrder(IsBuy, IsEntry, Contracts)

Where:

IsBuy - indicates whether order is buy or sell;
IsEntry - indicates whether order is entry or exit;
Contracts - indicates the number of contracts/shares of the order.

Notes

  • Works only with auto trading turned on.
  • Can be used as a mean of synchronization of strategy market position with a broker.
  • Also see the related ChangeMarketPosition keyword.

Example

If MarketPosition*CurrentContracts = 2 and MarketPosition_at_Broker = 4 then PlaceMarketOrder (false, false, 2);

Will generate sell market order for 2 contracts to synchronize market position at broker with the strategy position.

Please refer to !From Strategy To Broker MP Synchronizer! default signal for more examples.