CloseAllAtMarket

CloseAllAtMarket
public void CloseAllAtMarket()

The method closes absolutely all open and opening positions at the market price.

Consider a situation of ladder buying. As long as the price diverges up from the moving average by a set value, we will continue to open new long positions at the close of each candle. The maximum allowable number of simultaneously open positions will be limited to 5. As soon as the next candle closes below the moving average, we will close all positions.

1. We open positions as long as the necessary conditions are met.

2. We close all positions on the market using the CloseAllAtMarket method.

public void CloseAllAtMarket(string signalType)

The second overload accepts a string with a closure signal that will be displayed in the positions table.

We will add a new condition that limits trading within a time frame. If there are open positions at a specific point in time, we will close all positions and prohibit trading until the next session.

1. If the price is above the SMA and additional conditions are met, we buy at the close of each candle, until the total number of positions reaches 5.

2. If the price is above the SMA, we close all at the market, passing a single signal.

3. We close all at the market if the specified time has arrived.

In the program interface, you can see under which signal the positions were closed.

If you have any difficulties or questions, please write to the support chat. Link