PlaceMarketOrder  [SOLVED]

Questions about MultiCharts and user contributed studies.
maxmax68
Posts: 163
Joined: 20 Nov 2012
Has thanked: 55 times
Been thanked: 48 times

PlaceMarketOrder  [SOLVED]

Postby maxmax68 » 28 Oct 2019

Hello,

in a previous topic I was given these instructions for using the keyword PlaceMarketOrder(isbuy,isentry,contracts);:


PlaceMarketOrder(false, false, 2); // Long +2 to Flat 0

PlaceMarketOrder(false, true, 3); // Long +2 to Short -1

PlaceMarketOrder(true, false, 2); // Short -2 to Flat 0

PlaceMarketOrder(true, true, 3); // Short -2 to Long +1

PlaceMarketOrder(true, true, 2); // Flat 0 to Long +2

//PlaceMarketOrder(isbuy,isentry,contracts);

I need help to better understand the "isbuy" and "isentry" parameters.

Suppose we use PlaceMarketOrder in a Signal on a chart that autotrades in AA mode.

Obviously the "contracts" parameter indicates the number of contracts that must be sent with our order.
"isbuy" parameter = true means that we are sending a buy order,
while "isbuy" = false means that we are sending a sell order.

For what I understand PlaceMarketOrder sends orders from the signal to the broker in an invisible way to the market position of the chart and to the market position of the strategy, instead the market position of the broker is changed for the sent order.

So the question is:
What is the function of "isentry" parameter ?

From Flat 0 to Short -2
both
PlaceMarketOrder(false, true, 2);
and
PlaceMarketOrder(false, false, 2);

will fire a sell order of 2 contracts to the broker? Or not?

And from Long2 to Flat 0
both
PlaceMarketOrder(false, true, 2);
and
PlaceMarketOrder(false, false, 2);

will fire a sell order of 2 contracts to the broker? Or not?

When does the "isentry" parameter come into play?

Best regards
Massimo

User avatar
Svetlana MultiCharts
Posts: 645
Joined: 19 Oct 2017
Has thanked: 3 times
Been thanked: 163 times

Re: PlaceMarketOrder

Postby Svetlana MultiCharts » 31 Oct 2019

Hello, Massimo,
"isbuy" parameter = true means that we are sending a buy order,
while "isbuy" = false means that we are sending a sell order.
Your understanding is correct.

As for isentry, you can set any parameter. It does not influence on anything and is kept for compatibility.
From Flat 0 to Short -2
both
PlaceMarketOrder(false, true, 2);
and
PlaceMarketOrder(false, false, 2);

will fire a sell order of 2 contracts to the broker? Or not?
Yes, it will
And from Long2 to Flat 0
both
PlaceMarketOrder(false, true, 2);
and
PlaceMarketOrder(false, false, 2);

will fire a sell order of 2 contracts to the broker? Or not?
Yes, it will


Return to “MultiCharts”