
In this article, we will talk about analyzing order book movement after the base signal has occurred. This is necessary to analyze the possibility of front-running slow robots working with market orders.
Creating a robot for analyzing movement.
To create an instance of the robot, as in other cases, we need to open the simplified trading interface and click the "add robot" button:

1. Enter a unique name for the robot.
2. Select the type of robot. In this case, it is CurrencyMoveExplorer. Click on it with the left mouse button to highlight the robot's name in orange.
3. Click the "Accept" button.
Connecting sequences in trading.
Connecting to the server and creating pairs of instruments for currency arbitrage are described in this article, and are fully applicable to this robot.
To continue, you must:
1. Connect to the server.
2. Set up pairs of instruments for trading.
Recommended initial settings:

1. Call the robot's interface.
2. Call general settings.
3. Recommended settings for the minimum specified commission, even if you pay it in another currency.
4. Recommended minimum settings for the generated signal so that the robot can see them.
5. Note that the "Emulator" mode is enabled. You don't need to enable live trading right away until you've familiarized yourself with everything.
Robot parameters.
Called from the simplified trading interface by pressing the "Parameters" button:

General mode. On / Off
How the robot works and what it does.
As soon as a signal comes from BotTabPolygon that the profit has exceeded the signal value, the robot begins to log the current profit for the pair. Once every 200 milliseconds.
The signal looks like this:

You can view the profitability records in the robot's log after the signal:

But it's better to do this from the file system. Open the log file directly:

Robot code review.
The robot's source code is located within the project here:

The entire code is 113 lines long.

Usings are standard for robots in OsEngine.

Except for the last part. The robot uses an additional thread, which is responsible for saving profitability data. Therefore, there is System.Threading here.
Fields.

1. The BotTabPolygon source, where signals are calculated, sequence settings, and trading logic occur.
2. Parameter. On / Off.
Constructor.

1. Creating a source for currency arbitrage, as well as saving it as a class field.
2. Subscribing to the event of exceeding the signal value of profit within the sequence.
3. Creating a parameter for the robot.
4. Creating a thread that saves profitability for 3 seconds after the signal.
Logic.

1. Handler for the event of exceeding the profit over the signal.
2. Mechanism for starting to collect information about the profitability of the sequence.
3. Thread recording profitability for the sequence after the signal.
4. Mechanism to stop recording profitability for the sequence of instruments.
5. Recording the profitability of the sequence in the log.
If you have any difficulties or questions, please write to the support chat. Link