Two MA Other TimeFrame Correct Intersection

Download script
Author: Copyright © 2021-2022, Vladimir Karputov

This script is a professional automated trading engine designed for the MetaTrader 5 platform. It focuses on executing trades based on moving average crossovers while implementing rigorous safety checks to ensure account stability and proper order management.

Below is a breakdown of how the logic works in plain English:

Core Trading Strategy

The system operates by monitoring two different Moving Averages (MA). It distinguishes between a "Fast" MA and a "Slow" MA, which can even be set to different timeframes (for example, comparing data from a 1-hour chart against a Daily chart).

  • Buy Signal: The system looks for a specific crossover where the Fast MA was previously below the Slow MA but moves above it.
  • Sell Signal: Conversely, it looks for the Fast MA moving from above the Slow MA to below it.
  • Timing: To ensure accuracy, the script only scans for these signals at the exact moment a new candle (bar) is born on the chart.

Smart Order Management

One of the most robust features of this script is its "Waiting Transaction" logic. Trading can sometimes face delays due to broker latency or internet speeds; this script handles that by:

  1. Identifying when an order has been sent but not yet confirmed by the server.
  2. Placing that order in a "waiting" state so the system doesn't try to open multiple duplicate trades for the same signal.
  3. Automatically removing the request from the queue once the broker confirms the trade is active.

Safety and Risk Controls

The engine includes several layers of "fail-safes" to protect your capital:

  • Volume Validation: Before placing any trade, the script automatically verifies that the requested lot size is allowed by your broker (checking against both minimum and maximum limits).
  • Margin Protection: It performs a real-time "Free Margin Check." If the account does not have enough available funds to cover the required margin for a new trade, the script will block the operation to prevent "out of money" errors.
  • Symbol Restrictions: It intelligently detects if a specific currency pair allows only buying, only selling, or only closing positions, and it will automatically skip signals that violate those rules.
  • Magic Number Tracking: It uses a unique identification number (Magic Number) to ensure it only manages the trades it opened, leaving your other manual or automated trades untouched.

Logging and Diagnostics

For users who want to monitor performance, the script includes an optional logging system. If enabled, it provides detailed feedback on:

  • Successful trade executions.
  • Specific reasons for failed orders (e.g., "Market Closed" or "Trade Disabled").
  • Exact price confirmations received from the broker compared to the current market quote.
Price Data Components
Series array that contains tick volumes of each bar
Miscellaneous
It issuies visual alerts to the screen
5 Views
0 Downloads
0 Favorites
Two MA Other TimeFrame Correct Intersection
ÿþ/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� � � � � � � � � � � � � � � � � � �T�w�o� �M�A� �O�t�h�e�r� �T�i�m�e�F�r�a�m�e� �C�o�r�r�e�c�t� �I�n�t�e�r�s�e�c�t�i�o�n�.�m�q�5� �|�
�
�/�/�|� � � � � � � � � � � � � � � � � � � � � � � � � �C�o�p�y�r�i�g�h�t� �©� �2�0�2�1�-�2�0�2�2�,� �V�l�a�d�i�m�i�r� �K�a�r�p�u�t�o�v� �|�
�
�/�/�|� � � � � � � � � � � � � � � � � � � � � � �h�t�t�p�s�:�/�/�w�w�w�.�m�q�l�5�.�c�o�m�/�e�n�/�u�s�e�r�s�/�b�a�r�a�b�a�s�h�k�a�k�v�n� �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�#�p�r�o�p�e�r�t�y� �c�o�p�y�r�i�g�h�t� �"�C�o�p�y�r�i�g�h�t� �©� �2�0�2�1�-�2�0�2�2�,� �V�l�a�d�i�m�i�r� �K�a�r�p�u�t�o�v�"�
�
�#�p�r�o�p�e�r�t�y� �l�i�n�k� � � � � � �"�h�t�t�p�s�:�/�/�w�w�w�.�m�q�l�5�.�c�o�m�/�e�n�/�u�s�e�r�s�/�b�a�r�a�b�a�s�h�k�a�k�v�n�"�
�
�#�p�r�o�p�e�r�t�y� �v�e�r�s�i�o�n� � � �"�4�.�0�1�6�"�
�
�#�p�r�o�p�e�r�t�y� �d�e�s�c�r�i�p�t�i�o�n� �"�b�a�r�a�b�a�s�h�k�a�k�v�n� �T�r�a�d�i�n�g� �e�n�g�i�n�e� �4�.�0�1�6�"�
�
�#�p�r�o�p�e�r�t�y� �d�e�s�c�r�i�p�t�i�o�n� �"�T�a�k�e� �P�r�o�f�i�t�,� �S�t�o�p� �L�o�s�s� �a�n�d� �T�r�a�i�l�i�n�g� �-� �i�n� �P�o�i�n�t�s� �(�1�.�0�0�0�5�5�-�1�.�0�0�0�4�5�=�1�0� �p�o�i�n�t�s�)�"�
�
�/�*�
�
� � � �b�a�r�a�b�a�s�h�k�a�k�v�n� �T�r�a�d�i�n�g� �e�n�g�i�n�e� �4�.�0�1�6�
�
�*�/�
�
�#�i�n�c�l�u�d�e� �<�T�r�a�d�e�\�P�o�s�i�t�i�o�n�I�n�f�o�.�m�q�h�>�
�
�#�i�n�c�l�u�d�e� �<�T�r�a�d�e�\�T�r�a�d�e�.�m�q�h�>�
�
�#�i�n�c�l�u�d�e� �<�T�r�a�d�e�\�S�y�m�b�o�l�I�n�f�o�.�m�q�h�>�
�
�#�i�n�c�l�u�d�e� �<�T�r�a�d�e�\�A�c�c�o�u�n�t�I�n�f�o�.�m�q�h�>�
�
�#�i�n�c�l�u�d�e� �<�T�r�a�d�e�\�D�e�a�l�I�n�f�o�.�m�q�h�>�
�
�/�/�-�-�-�
�
�C�P�o�s�i�t�i�o�n�I�n�f�o� � �m�_�p�o�s�i�t�i�o�n�;� � � � � � � � � � � � � � � � � � � �/�/� �o�b�j�e�c�t� �o�f� �C�P�o�s�i�t�i�o�n�I�n�f�o� �c�l�a�s�s�
�
�C�T�r�a�d�e� � � � � � � � � �m�_�t�r�a�d�e�;� � � � � � � � � � � � � � � � � � � � � � �/�/� �o�b�j�e�c�t� �o�f� �C�T�r�a�d�e� �c�l�a�s�s�
�
�C�S�y�m�b�o�l�I�n�f�o� � � � �m�_�s�y�m�b�o�l�;� � � � � � � � � � � � � � � � � � � � � �/�/� �o�b�j�e�c�t� �o�f� �C�S�y�m�b�o�l�I�n�f�o� �c�l�a�s�s�
�
�C�A�c�c�o�u�n�t�I�n�f�o� � � �m�_�a�c�c�o�u�n�t�;� � � � � � � � � � � � � � � � � � � � �/�/� �o�b�j�e�c�t� �o�f� �C�A�c�c�o�u�n�t�I�n�f�o� �c�l�a�s�s�
�
�C�D�e�a�l�I�n�f�o� � � � � � �m�_�d�e�a�l�;� � � � � � � � � � � � � � � � � � � � � � � �/�/� �o�b�j�e�c�t� �o�f� �C�D�e�a�l�I�n�f�o� �c�l�a�s�s�
�
�/�/�-�-�-� �i�n�p�u�t� �p�a�r�a�m�e�t�e�r�s�
�
�i�n�p�u�t� �g�r�o�u�p� � � � � � � � � � � � � �"�P�o�s�i�t�i�o�n� �s�i�z�e� �m�a�n�a�g�e�m�e�n�t� �(�l�o�t� �c�a�l�c�u�l�a�t�i�o�n�)�"�
�
�i�n�p�u�t� �d�o�u�b�l�e� � � � � � � � � � � � � � � �I�n�p�L�o�t�s� � � � � � � � � � � � � � � � � �=� �0�.�0�1�;� � � � � � � � � � � �/�/� �L�o�t�s�
�
�i�n�p�u�t� �g�r�o�u�p� � � � � � � � � � � � � �"�M�A� �O�t�h�e�r� �T�i�m�e�F�r�a�m�e�"�
�
�i�n�p�u�t� �g�r�o�u�p� � � � � � � � � � � � � �"�-�-�-�>� �F�a�s�t�"�
�
�i�n�p�u�t� �E�N�U�M�_�T�I�M�E�F�R�A�M�E�S� � � � � � �I�n�p�_�M�A�_�F�a�s�t�_�p�e�r�i�o�d�_�o�t�h�e�r� � � �=� �P�E�R�I�O�D�_�H�1�;� � � �/�/� �M�A� �F�a�s�t�:� �o�t�h�e�r� �t�i�m�e�f�r�a�m�e�
�
�i�n�p�u�t� �i�n�t� � � � � � � � � � � � � � � � � � �I�n�p�_�M�A�_�F�a�s�t�_�m�a�_�p�e�r�i�o�d� � � � � � �=� �1�2�;� � � � � � � � � � �/�/� �M�A� �F�a�s�t�:� �a�v�e�r�a�g�i�n�g� �p�e�r�i�o�d�
�
�i�n�p�u�t� �i�n�t� � � � � � � � � � � � � � � � � � �I�n�p�_�M�A�_�F�a�s�t�_�m�a�_�s�h�i�f�t� � � � � � � �=� �0�;� � � � � � � � � � � �/�/� �M�A� �F�a�s�t�:� �h�o�r�i�z�o�n�t�a�l� �s�h�i�f�t�
�
�i�n�p�u�t� �E�N�U�M�_�M�A�_�M�E�T�H�O�D� � � � � � � �I�n�p�_�M�A�_�F�a�s�t�_�m�a�_�m�e�t�h�o�d� � � � � � �=� �M�O�D�E�_�S�M�A�;� � � � �/�/� �M�A� �F�a�s�t�:� �s�m�o�o�t�h�i�n�g� �t�y�p�e�
�
�i�n�p�u�t� �E�N�U�M�_�A�P�P�L�I�E�D�_�P�R�I�C�E� � � �I�n�p�_�M�A�_�F�a�s�t�_�a�p�p�l�i�e�d�_�p�r�i�c�e� � �=� �P�R�I�C�E�_�C�L�O�S�E�;� �/�/� �M�A� �F�a�s�t�:� �t�y�p�e� �o�f� �p�r�i�c�e�
�
�i�n�p�u�t� �g�r�o�u�p� � � � � � � � � � � � � �"�-�-�-�>� �S�l�o�w�"�
�
�i�n�p�u�t� �E�N�U�M�_�T�I�M�E�F�R�A�M�E�S� � � � � � �I�n�p�_�M�A�_�S�l�o�w�_�p�e�r�i�o�d�_�o�t�h�e�r� � � �=� �P�E�R�I�O�D�_�D�1�;� � � �/�/� �M�A� �S�l�o�w�:� �o�t�h�e�r� �t�i�m�e�f�r�a�m�e�
�
�i�n�p�u�t� �i�n�t� � � � � � � � � � � � � � � � � � �I�n�p�_�M�A�_�S�l�o�w�_�m�a�_�p�e�r�i�o�d� � � � � � �=� �1�2�;� � � � � � � � � � �/�/� �M�A� �S�l�o�w�:� �a�v�e�r�a�g�i�n�g� �p�e�r�i�o�d�
�
�i�n�p�u�t� �i�n�t� � � � � � � � � � � � � � � � � � �I�n�p�_�M�A�_�S�l�o�w�_�m�a�_�s�h�i�f�t� � � � � � � �=� �0�;� � � � � � � � � � � �/�/� �M�A� �S�l�o�w�:� �h�o�r�i�z�o�n�t�a�l� �s�h�i�f�t�
�
�i�n�p�u�t� �E�N�U�M�_�M�A�_�M�E�T�H�O�D� � � � � � � �I�n�p�_�M�A�_�S�l�o�w�_�m�a�_�m�e�t�h�o�d� � � � � � �=� �M�O�D�E�_�S�M�A�;� � � � �/�/� �M�A� �S�l�o�w�:� �s�m�o�o�t�h�i�n�g� �t�y�p�e�
�
�i�n�p�u�t� �E�N�U�M�_�A�P�P�L�I�E�D�_�P�R�I�C�E� � � �I�n�p�_�M�A�_�S�l�o�w�_�a�p�p�l�i�e�d�_�p�r�i�c�e� � �=� �P�R�I�C�E�_�C�L�O�S�E�;� �/�/� �M�A� �S�l�o�w�:� �t�y�p�e� �o�f� �p�r�i�c�e�
�
�i�n�p�u�t� �g�r�o�u�p� � � � � � � � � � � � � �"�A�d�d�i�t�i�o�n�a�l� �f�e�a�t�u�r�e�s�"�
�
�i�n�p�u�t� �b�o�o�l� � � � � � � � � � � � � � � � � �I�n�p�P�r�i�n�t�L�o�g� � � � � � � � � � � � � �=� �t�r�u�e�;� � � � � � � � � � � �/�/� �P�r�i�n�t� �l�o�g�
�
�i�n�p�u�t� �u�c�h�a�r� � � � � � � � � � � � � � � � �I�n�p�F�r�e�e�z�e�C�o�e�f�f�i�c�i�e�n�t� � � � �=� �3�;� � � � � � � � � � � � � � �/�/� �C�o�e�f�f�i�c�i�e�n�t� �(�i�f� �F�r�e�e�z�e�=�=�0� �O�r� �S�t�o�p�s�L�e�v�e�l�s�=�=�0�)�
�
�i�n�p�u�t� �u�l�o�n�g� � � � � � � � � � � � � � � � �I�n�p�D�e�v�i�a�t�i�o�n� � � � � � � � � � � � �=� �1�0�;� � � � � � � � � � � � � �/�/� �D�e�v�i�a�t�i�o�n�,� �i�n� �P�o�i�n�t�s� �(�1�.�0�0�0�4�5�-�1�.�0�0�0�5�5�=�1�0� �p�o�i�n�t�s�)�
�
�i�n�p�u�t� �u�l�o�n�g� � � � � � � � � � � � � � � � �I�n�p�M�a�g�i�c� � � � � � � � � � � � � � � � �=� �1�8�8�0�1�1�8�2�4�;� � � � � � �/�/� �M�a�g�i�c� �n�u�m�b�e�r�
�
�/�/�-�-�-�
�
�i�n�t� � � � � � �h�a�n�d�l�e�_�i�C�u�s�t�o�m�_�F�a�s�t�;� � � � � � � � � � � � � � � � � � � �/�/� �v�a�r�i�a�b�l�e� �f�o�r� �s�t�o�r�i�n�g� �t�h�e� �h�a�n�d�l�e� �o�f� �t�h�e� �i�C�u�s�t�o�m� �i�n�d�i�c�a�t�o�r�
�
�i�n�t� � � � � � �h�a�n�d�l�e�_�i�C�u�s�t�o�m�_�S�l�o�w�;� � � � � � � � � � � � � � � � � � � �/�/� �v�a�r�i�a�b�l�e� �f�o�r� �s�t�o�r�i�n�g� �t�h�e� �h�a�n�d�l�e� �o�f� �t�h�e� �i�C�u�s�t�o�m� �i�n�d�i�c�a�t�o�r�
�
�
�
�d�a�t�e�t�i�m�e� �m�_�p�r�e�v�_�b�a�r�s� � � � � � � � � � � � � � � � �=� �0�;� � � � � � � � �/�/� �"�0�"� �-�>� �D�'�1�9�7�0�.�0�1�.�0�1� �0�0�:�0�0�'�;�
�
�b�o�o�l� � � � � �m�_�i�n�i�t�_�e�r�r�o�r� � � � � � � � � � � � � � � �=� �f�a�l�s�e�;� � � � �/�/� �e�r�r�o�r� �o�n� �I�n�I�n�i�t�
�
�/�/�-�-�-� �t�h�e� �t�a�c�t�i�c� �i�s� �t�h�i�s�:� �f�o�r� �p�o�s�i�t�i�o�n�s� �w�e� �s�t�r�i�c�t�l�y� �m�o�n�i�t�o�r� �t�h�e� �r�e�s�u�l�t�,� �*�*�*�
�
�/�/�-�-�-� � � � �a�n�d� �p�e�n�d�i�n�g� �o�r�d�e�r�s� �(�i�f� �t�h�e� �s�p�r�e�a�d� �w�a�s� �v�e�r�i�f�i�e�d�)�
�
�/�/�-�-�-� � � � �j�u�s�t� �s�h�o�o�t� �a�n�d� �z�e�r�o� �o�u�t� �t�h�e� �a�r�r�a�y�s� �o�f� �s�t�r�u�c�t�u�r�e�s�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �S�t�r�u�c�t�u�r�e� �P�o�s�i�t�i�o�n�s� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�s�t�r�u�c�t� �S�T�R�U�C�T�_�P�O�S�I�T�I�O�N�
�
� � �{�
�
� � � �E�N�U�M�_�P�O�S�I�T�I�O�N�_�T�Y�P�E� �p�o�s�_�t�y�p�e�;� � � � � � � � � � � � � � �/�/� �p�o�s�i�t�i�o�n� �t�y�p�e�
�
� � � �b�o�o�l� � � � � � � � � � � � � � �w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�;� � � � �/�/� �w�a�i�t�i�n�g� �t�r�a�n�s�a�c�t�i�o�n�,� �"�t�r�u�e�"� �-�>� �i�t�'�s� �f�o�r�b�i�d�d�e�n� �t�o� �t�r�a�d�e�,� �w�e� �e�x�p�e�c�t� �a� �t�r�a�n�s�a�c�t�i�o�n�
�
� � � �u�l�o�n�g� � � � � � � � � � � � � �w�a�i�t�i�n�g�_�o�r�d�e�r�_�t�i�c�k�e�t�;� � � �/�/� �w�a�i�t�i�n�g� �o�r�d�e�r� �t�i�c�k�e�t�,� �t�i�c�k�e�t� �o�f� �t�h�e� �e�x�p�e�c�t�e�d� �o�r�d�e�r�
�
� � � �b�o�o�l� � � � � � � � � � � � � � �t�r�a�n�s�a�c�t�i�o�n�_�c�o�n�f�i�r�m�e�d�;� � �/�/� �t�r�a�n�s�a�c�t�i�o�n� �c�o�n�f�i�r�m�e�d�,� �"�t�r�u�e�"� �-�>� �t�r�a�n�s�a�c�t�i�o�n� �c�o�n�f�i�r�m�e�d�
�
� � � �/�/�-�-�-� �C�o�n�s�t�r�u�c�t�o�r�
�
� � � � � � � � � � � � � � � � � � � � � �S�T�R�U�C�T�_�P�O�S�I�T�I�O�N�(�)�
�
� � � � � �{�
�
� � � � � � �p�o�s�_�t�y�p�e� � � � � � � � � � � � � � � � � � � �=� �W�R�O�N�G�_�V�A�L�U�E�;�
�
� � � � � � �w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n� � � � � � � � �=� �f�a�l�s�e�;�
�
� � � � � � �w�a�i�t�i�n�g�_�o�r�d�e�r�_�t�i�c�k�e�t� � � � � � � �=� �0�;�
�
� � � � � � �t�r�a�n�s�a�c�t�i�o�n�_�c�o�n�f�i�r�m�e�d� � � � � � �=� �f�a�l�s�e�;�
�
� � � � � �}�
�
� � �}�;�
�
�S�T�R�U�C�T�_�P�O�S�I�T�I�O�N� �S�P�o�s�i�t�i�o�n�[�]�;�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �E�x�p�e�r�t� �i�n�i�t�i�a�l�i�z�a�t�i�o�n� �f�u�n�c�t�i�o�n� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�i�n�t� �O�n�I�n�i�t�(�)�
�
� � �{�
�
�/�/�-�-�-� �f�o�r�c�e�d� �i�n�i�t�i�a�l�i�z�a�t�i�o�n� �o�f� �v�a�r�i�a�b�l�e�s�
�
� � � �m�_�p�r�e�v�_�b�a�r�s� � � � � � � � � � � � � � � � �=� �0�;� � � � � � � � �/�/� �"�0�"� �-�>� �D�'�1�9�7�0�.�0�1�.�0�1� �0�0�:�0�0�'�;�
�
� � � �m�_�i�n�i�t�_�e�r�r�o�r� � � � � � � � � � � � � � � �=� �f�a�l�s�e�;� � � � �/�/� �e�r�r�o�r� �o�n� �I�n�I�n�i�t�
�
�/�/�-�-�-�
�
� � � �R�e�s�e�t�L�a�s�t�E�r�r�o�r�(�)�;�
�
� � � �i�f�(�!�m�_�s�y�m�b�o�l�.�N�a�m�e�(�S�y�m�b�o�l�(�)�)�)� �/�/� �s�e�t�s� �s�y�m�b�o�l� �n�a�m�e�
�
� � � � � �{�
�
� � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �C�S�y�m�b�o�l�I�n�f�o�.�N�a�m�e�"�)�;�
�
� � � � � � �r�e�t�u�r�n�(�I�N�I�T�_�F�A�I�L�E�D�)�;�
�
� � � � � �}�
�
� � � �R�e�f�r�e�s�h�R�a�t�e�s�(�)�;�
�
�/�/�-�-�-�
�
� � � �m�_�t�r�a�d�e�.�S�e�t�E�x�p�e�r�t�M�a�g�i�c�N�u�m�b�e�r�(�I�n�p�M�a�g�i�c�)�;�
�
� � � �m�_�t�r�a�d�e�.�S�e�t�M�a�r�g�i�n�M�o�d�e�(�)�;�
�
� � � �m�_�t�r�a�d�e�.�S�e�t�T�y�p�e�F�i�l�l�i�n�g�B�y�S�y�m�b�o�l�(�m�_�s�y�m�b�o�l�.�N�a�m�e�(�)�)�;�
�
� � � �m�_�t�r�a�d�e�.�S�e�t�D�e�v�i�a�t�i�o�n�I�n�P�o�i�n�t�s�(�I�n�p�D�e�v�i�a�t�i�o�n�)�;�
�
�/�/�-�-�-� �c�h�e�c�k� �t�h�e� �i�n�p�u�t� �p�a�r�a�m�e�t�e�r� �"�L�o�t�s�"�
�
� � � �s�t�r�i�n�g� �e�r�r�_�t�e�x�t�=�"�"�;�
�
� � � �i�f�(�!�C�h�e�c�k�V�o�l�u�m�e�V�a�l�u�e�(�I�n�p�L�o�t�s�,�e�r�r�_�t�e�x�t�)�)�
�
� � � � � �{�
�
� � � � � � �i�f�(�M�Q�L�I�n�f�o�I�n�t�e�g�e�r�(�M�Q�L�_�T�E�S�T�E�R�)�)� �/�/� �w�h�e�n� �t�e�s�t�i�n�g�,� �w�e� �w�i�l�l� �o�n�l�y� �o�u�t�p�u�t� �t�o� �t�h�e� �l�o�g� �a�b�o�u�t� �i�n�c�o�r�r�e�c�t� �i�n�p�u�t� �p�a�r�a�m�e�t�e�r�s�
�
� � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�e�r�r�_�t�e�x�t�)�;�
�
� � � � � � �e�l�s�e� �/�/� �i�f� �t�h�e� �E�x�p�e�r�t� �A�d�v�i�s�o�r� �i�s� �r�u�n� �o�n� �t�h�e� �c�h�a�r�t�,� �t�e�l�l� �t�h�e� �u�s�e�r� �a�b�o�u�t� �t�h�e� �e�r�r�o�r�
�
� � � � � � � � � �A�l�e�r�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�e�r�r�_�t�e�x�t�)�;�
�
� � � � � � �/�/�-�-�-�
�
� � � � � � �m�_�i�n�i�t�_�e�r�r�o�r�=�t�r�u�e�;�
�
� � � � � � �r�e�t�u�r�n�(�I�N�I�T�_�S�U�C�C�E�E�D�E�D�)�;�
�
� � � � � �}�
�
�/�/�-�-�-� �c�r�e�a�t�e� �h�a�n�d�l�e� �o�f� �t�h�e� �i�n�d�i�c�a�t�o�r� �i�C�u�s�t�o�m�
�
� � � �h�a�n�d�l�e�_�i�C�u�s�t�o�m�_�F�a�s�t�=�i�C�u�s�t�o�m�(�m�_�s�y�m�b�o�l�.�N�a�m�e�(�)�,�P�e�r�i�o�d�(�)�,�"�M�A� �O�t�h�e�r� �T�i�m�e�F�r�a�m�e� �C�o�r�r�e�c�t�"�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �"�M�A�"�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �I�n�p�_�M�A�_�F�a�s�t�_�p�e�r�i�o�d�_�o�t�h�e�r�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �I�n�p�_�M�A�_�F�a�s�t�_�m�a�_�p�e�r�i�o�d�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �I�n�p�_�M�A�_�F�a�s�t�_�m�a�_�s�h�i�f�t�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �I�n�p�_�M�A�_�F�a�s�t�_�m�a�_�m�e�t�h�o�d�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �I�n�p�_�M�A�_�F�a�s�t�_�a�p�p�l�i�e�d�_�p�r�i�c�e�)�;�
�
�/�/�-�-�-� �i�f� �t�h�e� �h�a�n�d�l�e� �i�s� �n�o�t� �c�r�e�a�t�e�d�
�
� � � �i�f�(�h�a�n�d�l�e�_�i�C�u�s�t�o�m�_�F�a�s�t�=�=�I�N�V�A�L�I�D�_�H�A�N�D�L�E�)�
�
� � � � � �{�
�
� � � � � � �/�/�-�-�-� �t�e�l�l� �a�b�o�u�t� �t�h�e� �f�a�i�l�u�r�e� �a�n�d� �o�u�t�p�u�t� �t�h�e� �e�r�r�o�r� �c�o�d�e�
�
� � � � � � �P�r�i�n�t�F�o�r�m�a�t�(�"�F�a�i�l�e�d� �t�o� �c�r�e�a�t�e� �h�a�n�d�l�e� �o�f� �t�h�e� �i�C�u�s�t�o�m� �i�n�d�i�c�a�t�o�r� �(�'�F�a�s�t�'�)� �f�o�r� �t�h�e� �s�y�m�b�o�l� �%�s�/�%�s�,� �e�r�r�o�r� �c�o�d�e� �%�d�"�,�
�
� � � � � � � � � � � � � � � � � � �m�_�s�y�m�b�o�l�.�N�a�m�e�(�)�,�
�
� � � � � � � � � � � � � � � � � � �E�n�u�m�T�o�S�t�r�i�n�g�(�P�e�r�i�o�d�(�)�)�,�
�
� � � � � � � � � � � � � � � � � � �G�e�t�L�a�s�t�E�r�r�o�r�(�)�)�;�
�
� � � � � � �/�/�-�-�-� �t�h�e� �i�n�d�i�c�a�t�o�r� �i�s� �s�t�o�p�p�e�d� �e�a�r�l�y�
�
� � � � � � �m�_�i�n�i�t�_�e�r�r�o�r�=�t�r�u�e�;�
�
� � � � � � �r�e�t�u�r�n�(�I�N�I�T�_�S�U�C�C�E�E�D�E�D�)�;�
�
� � � � � �}�
�
�/�/�-�-�-� �c�r�e�a�t�e� �h�a�n�d�l�e� �o�f� �t�h�e� �i�n�d�i�c�a�t�o�r� �i�C�u�s�t�o�m�
�
� � � �h�a�n�d�l�e�_�i�C�u�s�t�o�m�_�S�l�o�w�=�i�C�u�s�t�o�m�(�m�_�s�y�m�b�o�l�.�N�a�m�e�(�)�,�P�e�r�i�o�d�(�)�,�"�M�A� �O�t�h�e�r� �T�i�m�e�F�r�a�m�e� �C�o�r�r�e�c�t�"�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �"�M�A�"�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �I�n�p�_�M�A�_�S�l�o�w�_�p�e�r�i�o�d�_�o�t�h�e�r�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �I�n�p�_�M�A�_�S�l�o�w�_�m�a�_�p�e�r�i�o�d�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �I�n�p�_�M�A�_�S�l�o�w�_�m�a�_�s�h�i�f�t�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �I�n�p�_�M�A�_�S�l�o�w�_�m�a�_�m�e�t�h�o�d�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �I�n�p�_�M�A�_�S�l�o�w�_�a�p�p�l�i�e�d�_�p�r�i�c�e�)�;�
�
�/�/�-�-�-� �i�f� �t�h�e� �h�a�n�d�l�e� �i�s� �n�o�t� �c�r�e�a�t�e�d�
�
� � � �i�f�(�h�a�n�d�l�e�_�i�C�u�s�t�o�m�_�S�l�o�w�=�=�I�N�V�A�L�I�D�_�H�A�N�D�L�E�)�
�
� � � � � �{�
�
� � � � � � �/�/�-�-�-� �t�e�l�l� �a�b�o�u�t� �t�h�e� �f�a�i�l�u�r�e� �a�n�d� �o�u�t�p�u�t� �t�h�e� �e�r�r�o�r� �c�o�d�e�
�
� � � � � � �P�r�i�n�t�F�o�r�m�a�t�(�"�F�a�i�l�e�d� �t�o� �c�r�e�a�t�e� �h�a�n�d�l�e� �o�f� �t�h�e� �i�C�u�s�t�o�m� �i�n�d�i�c�a�t�o�r� �(�'�S�l�o�w�'�)� �f�o�r� �t�h�e� �s�y�m�b�o�l� �%�s�/�%�s�,� �e�r�r�o�r� �c�o�d�e� �%�d�"�,�
�
� � � � � � � � � � � � � � � � � � �m�_�s�y�m�b�o�l�.�N�a�m�e�(�)�,�
�
� � � � � � � � � � � � � � � � � � �E�n�u�m�T�o�S�t�r�i�n�g�(�P�e�r�i�o�d�(�)�)�,�
�
� � � � � � � � � � � � � � � � � � �G�e�t�L�a�s�t�E�r�r�o�r�(�)�)�;�
�
� � � � � � �/�/�-�-�-� �t�h�e� �i�n�d�i�c�a�t�o�r� �i�s� �s�t�o�p�p�e�d� �e�a�r�l�y�
�
� � � � � � �m�_�i�n�i�t�_�e�r�r�o�r�=�t�r�u�e�;�
�
� � � � � � �r�e�t�u�r�n�(�I�N�I�T�_�S�U�C�C�E�E�D�E�D�)�;�
�
� � � � � �}�
�
�/�/�-�-�-�
�
� � � �r�e�t�u�r�n�(�I�N�I�T�_�S�U�C�C�E�E�D�E�D�)�;�
�
� � �}�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �E�x�p�e�r�t� �d�e�i�n�i�t�i�a�l�i�z�a�t�i�o�n� �f�u�n�c�t�i�o�n� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�v�o�i�d� �O�n�D�e�i�n�i�t�(�c�o�n�s�t� �i�n�t� �r�e�a�s�o�n�)�
�
� � �{�
�
�/�/�-�-�-�
�
� � �}�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �E�x�p�e�r�t� �t�i�c�k� �f�u�n�c�t�i�o�n� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�v�o�i�d� �O�n�T�i�c�k�(�)�
�
� � �{�
�
� � � �i�f�(�m�_�i�n�i�t�_�e�r�r�o�r�)�
�
� � � � � � �r�e�t�u�r�n�;�
�
�/�/�-�-�-�
�
� � � �i�n�t� �s�i�z�e�_�n�e�e�d�_�p�o�s�i�t�i�o�n�=�A�r�r�a�y�S�i�z�e�(�S�P�o�s�i�t�i�o�n�)�;�
�
� � � �i�f�(�s�i�z�e�_�n�e�e�d�_�p�o�s�i�t�i�o�n�>�0�)�
�
� � � � � �{�
�
� � � � � � �f�o�r�(�i�n�t� �i�=�s�i�z�e�_�n�e�e�d�_�p�o�s�i�t�i�o�n�-�1�;� �i�>�=�0�;� �i�-�-�)�
�
� � � � � � � � �{�
�
� � � � � � � � � �i�f�(�S�P�o�s�i�t�i�o�n�[�i�]�.�w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�)�
�
� � � � � � � � � � � �{�
�
� � � � � � � � � � � � �i�f�(�!�S�P�o�s�i�t�i�o�n�[�i�]�.�t�r�a�n�s�a�c�t�i�o�n�_�c�o�n�f�i�r�m�e�d�)�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �O�K�:� �"�,�"�t�r�a�n�s�a�c�t�i�o�n�_�c�o�n�f�i�r�m�e�d�:� �"�,�S�P�o�s�i�t�i�o�n�[�i�]�.�t�r�a�n�s�a�c�t�i�o�n�_�c�o�n�f�i�r�m�e�d�)�;�
�
� � � � � � � � � � � � � � � �r�e�t�u�r�n�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �e�l�s�e�
�
� � � � � � � � � � � � � � � �i�f�(�S�P�o�s�i�t�i�o�n�[�i�]�.�t�r�a�n�s�a�c�t�i�o�n�_�c�o�n�f�i�r�m�e�d�)�
�
� � � � � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � � � � �A�r�r�a�y�R�e�m�o�v�e�(�S�P�o�s�i�t�i�o�n�,�i�,�1�)�;�
�
� � � � � � � � � � � � � � � � � � �r�e�t�u�r�n�;�
�
� � � � � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � �}�
�
� � � � � � � � � �/�/�-�-�-�
�
� � � � � � � � � �i�n�t� � � � � � �c�o�u�n�t�_�b�u�y�s� � � � � � � � � � � �=� �0�;�
�
� � � � � � � � � �d�o�u�b�l�e� � � �v�o�l�u�m�e�_�b�u�y�s� � � � � � � � � � �=� �0�.�0�;�
�
� � � � � � � � � �d�o�u�b�l�e� � � �v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�b�u�y�s� � �=� �0�.�0�;�
�
� � � � � � � � � �i�n�t� � � � � � �c�o�u�n�t�_�s�e�l�l�s� � � � � � � � � � �=� �0�;�
�
� � � � � � � � � �d�o�u�b�l�e� � � �v�o�l�u�m�e�_�s�e�l�l�s� � � � � � � � � �=� �0�.�0�;�
�
� � � � � � � � � �d�o�u�b�l�e� � � �v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�s�e�l�l�s� �=� �0�.�0�;�
�
� � � � � � � � � �C�a�l�c�u�l�a�t�e�A�l�l�P�o�s�i�t�i�o�n�s�(�c�o�u�n�t�_�b�u�y�s�,�v�o�l�u�m�e�_�b�u�y�s�,�v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�b�u�y�s�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �c�o�u�n�t�_�s�e�l�l�s�,�v�o�l�u�m�e�_�s�e�l�l�s�,�v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�s�e�l�l�s�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �f�a�l�s�e�)�;�
�
� � � � � � � � � �/�/�-�-�-�
�
� � � � � � � � � �i�f�(�S�P�o�s�i�t�i�o�n�[�i�]�.�p�o�s�_�t�y�p�e�=�=�P�O�S�I�T�I�O�N�_�T�Y�P�E�_�B�U�Y�)�
�
� � � � � � � � � � � �{�
�
� � � � � � � � � � � � �/�/�-�-�-�
�
� � � � � � � � � � � � �i�f�(�c�o�u�n�t�_�s�e�l�l�s�>�0�)�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �C�l�o�s�e�P�o�s�i�t�i�o�n�s�(�P�O�S�I�T�I�O�N�_�T�Y�P�E�_�S�E�L�L�)�;�
�
� � � � � � � � � � � � � � � �r�e�t�u�r�n�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �/�/�-�-�-�
�
� � � � � � � � � � � � �i�f�(�c�o�u�n�t�_�b�u�y�s�+�c�o�u�n�t�_�s�e�l�l�s�=�=�0�)�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�]�.�w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�=�t�r�u�e�;�
�
� � � � � � � � � � � � � � � �O�p�e�n�P�o�s�i�t�i�o�n�(�i�)�;�
�
� � � � � � � � � � � � � � � �r�e�t�u�r�n�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �e�l�s�e�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �A�r�r�a�y�R�e�m�o�v�e�(�S�P�o�s�i�t�i�o�n�,�i�,�1�)�;�
�
� � � � � � � � � � � � � � � �r�e�t�u�r�n�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �/�/�-�-�-�
�
� � � � � � � � � � � � �r�e�t�u�r�n�;�
�
� � � � � � � � � � � �}�
�
� � � � � � � � � �i�f�(�S�P�o�s�i�t�i�o�n�[�i�]�.�p�o�s�_�t�y�p�e�=�=�P�O�S�I�T�I�O�N�_�T�Y�P�E�_�S�E�L�L�)�
�
� � � � � � � � � � � �{�
�
� � � � � � � � � � � � �/�/�-�-�-�
�
� � � � � � � � � � � � �i�f�(�c�o�u�n�t�_�b�u�y�s�>�0�)�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �C�l�o�s�e�P�o�s�i�t�i�o�n�s�(�P�O�S�I�T�I�O�N�_�T�Y�P�E�_�B�U�Y�)�;�
�
� � � � � � � � � � � � � � � �r�e�t�u�r�n�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �/�/�-�-�-�
�
� � � � � � � � � � � � �i�f�(�c�o�u�n�t�_�b�u�y�s�+�c�o�u�n�t�_�s�e�l�l�s�=�=�0�)�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�]�.�w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�=�t�r�u�e�;�
�
� � � � � � � � � � � � � � � �O�p�e�n�P�o�s�i�t�i�o�n�(�i�)�;�
�
� � � � � � � � � � � � � � � �r�e�t�u�r�n�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �e�l�s�e�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �A�r�r�a�y�R�e�m�o�v�e�(�S�P�o�s�i�t�i�o�n�,�i�,�1�)�;�
�
� � � � � � � � � � � � � � � �r�e�t�u�r�n�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �/�/�-�-�-�
�
� � � � � � � � � � � � �r�e�t�u�r�n�;�
�
� � � � � � � � � � � �}�
�
� � � � � � � � �}�
�
� � � � � �}�
�
�/�/�-�-�-� �w�e� �w�o�r�k� �o�n�l�y� �a�t� �t�h�e� �t�i�m�e� �o�f� �t�h�e� �b�i�r�t�h� �o�f� �n�e�w� �b�a�r�
�
� � � �d�a�t�e�t�i�m�e� �t�i�m�e�_�0�=�i�T�i�m�e�(�m�_�s�y�m�b�o�l�.�N�a�m�e�(�)�,�P�e�r�i�o�d�(�)�,�0�)�;�
�
� � � �i�f�(�t�i�m�e�_�0�=�=�m�_�p�r�e�v�_�b�a�r�s�)�
�
� � � � � � �r�e�t�u�r�n�;�
�
� � � �m�_�p�r�e�v�_�b�a�r�s�=�t�i�m�e�_�0�;�
�
�/�/� �s�e�a�r�c�h� �f�o�r� �t�r�a�d�i�n�g� �s�i�g�n�a�l�s� �o�n�l�y� �a�t� �t�h�e� �t�i�m�e� �o�f� �t�h�e� �b�i�r�t�h� �o�f� �n�e�w� �b�a�r�
�
� � � �i�f�(�!�R�e�f�r�e�s�h�R�a�t�e�s�(�)�)�
�
� � � � � �{�
�
� � � � � � �m�_�p�r�e�v�_�b�a�r�s�=�0�;�
�
� � � � � � �r�e�t�u�r�n�;�
�
� � � � � �}�
�
�/�/�-�-�-� �s�e�a�r�c�h� �f�o�r� �t�r�a�d�i�n�g� �s�i�g�n�a�l�s�
�
� � � �i�f�(�!�S�e�a�r�c�h�T�r�a�d�i�n�g�S�i�g�n�a�l�s�(�)�)�
�
� � � � � �{�
�
� � � � � � �m�_�p�r�e�v�_�b�a�r�s�=�0�;�
�
� � � � � � �r�e�t�u�r�n�;�
�
� � � � � �}�
�
�/�/�-�-�-�
�
� � �}�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �T�r�a�d�e�T�r�a�n�s�a�c�t�i�o�n� �f�u�n�c�t�i�o�n� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�v�o�i�d� �O�n�T�r�a�d�e�T�r�a�n�s�a�c�t�i�o�n�(�c�o�n�s�t� �M�q�l�T�r�a�d�e�T�r�a�n�s�a�c�t�i�o�n� �&�t�r�a�n�s�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � �c�o�n�s�t� �M�q�l�T�r�a�d�e�R�e�q�u�e�s�t� �&�r�e�q�u�e�s�t�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � �c�o�n�s�t� �M�q�l�T�r�a�d�e�R�e�s�u�l�t� �&�r�e�s�u�l�t�)�
�
� � �{�
�
�/�/�-�-�-� �g�e�t� �t�r�a�n�s�a�c�t�i�o�n� �t�y�p�e� �a�s� �e�n�u�m�e�r�a�t�i�o�n� �v�a�l�u�e�
�
� � � �E�N�U�M�_�T�R�A�D�E�_�T�R�A�N�S�A�C�T�I�O�N�_�T�Y�P�E� �t�y�p�e�=�t�r�a�n�s�.�t�y�p�e�;�
�
�/�/�-�-�-� �i�f� �t�r�a�n�s�a�c�t�i�o�n� �i�s� �r�e�s�u�l�t� �o�f� �a�d�d�i�t�i�o�n� �o�f� �t�h�e� �t�r�a�n�s�a�c�t�i�o�n� �i�n� �h�i�s�t�o�r�y�
�
� � � �i�f�(�t�y�p�e�=�=�T�R�A�D�E�_�T�R�A�N�S�A�C�T�I�O�N�_�D�E�A�L�_�A�D�D�)�
�
� � � � � �{�
�
� � � � � � �R�e�s�e�t�L�a�s�t�E�r�r�o�r�(�)�;�
�
� � � � � � �i�f�(�H�i�s�t�o�r�y�D�e�a�l�S�e�l�e�c�t�(�t�r�a�n�s�.�d�e�a�l�)�)�
�
� � � � � � � � � �m�_�d�e�a�l�.�T�i�c�k�e�t�(�t�r�a�n�s�.�d�e�a�l�)�;�
�
� � � � � � �e�l�s�e�
�
� � � � � � � � �{�
�
� � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�"�H�i�s�t�o�r�y�D�e�a�l�S�e�l�e�c�t�(�"�,�t�r�a�n�s�.�d�e�a�l�,�"�)� �e�r�r�o�r�:� �"�,�G�e�t�L�a�s�t�E�r�r�o�r�(�)�)�;�
�
� � � � � � � � � �r�e�t�u�r�n�;�
�
� � � � � � � � �}�
�
� � � � � � �i�f�(�m�_�d�e�a�l�.�S�y�m�b�o�l�(�)�=�=�m�_�s�y�m�b�o�l�.�N�a�m�e�(�)� �&�&� �m�_�d�e�a�l�.�M�a�g�i�c�(�)�=�=�I�n�p�M�a�g�i�c�)�
�
� � � � � � � � �{�
�
� � � � � � � � � �E�N�U�M�_�D�E�A�L�_�T�Y�P�E� �d�e�a�l�_�t�y�p�e� � � �=� �m�_�d�e�a�l�.�D�e�a�l�T�y�p�e�(�)�;�
�
� � � � � � � � � �E�N�U�M�_�D�E�A�L�_�E�N�T�R�Y� �d�e�a�l�_�e�n�t�r�y� �=� �m�_�d�e�a�l�.�E�n�t�r�y�(�)�;�
�
� � � � � � � � � �i�f�(�d�e�a�l�_�t�y�p�e�=�=�D�E�A�L�_�T�Y�P�E�_�B�U�Y� �|�|� �d�e�a�l�_�t�y�p�e�=�=�D�E�A�L�_�T�Y�P�E�_�S�E�L�L�)�
�
� � � � � � � � � � � �{�
�
� � � � � � � � � � � � �i�n�t� �s�i�z�e�_�n�e�e�d�_�p�o�s�i�t�i�o�n�=�A�r�r�a�y�S�i�z�e�(�S�P�o�s�i�t�i�o�n�)�;�
�
� � � � � � � � � � � � �i�f�(�s�i�z�e�_�n�e�e�d�_�p�o�s�i�t�i�o�n�>�0�)�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �f�o�r�(�i�n�t� �i�=�0�;� �i�<�s�i�z�e�_�n�e�e�d�_�p�o�s�i�t�i�o�n�;� �i�+�+�)�
�
� � � � � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � � � � �i�f�(�S�P�o�s�i�t�i�o�n�[�i�]�.�w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�)�
�
� � � � � � � � � � � � � � � � � � � � � �i�f�(�S�P�o�s�i�t�i�o�n�[�i�]�.�w�a�i�t�i�n�g�_�o�r�d�e�r�_�t�i�c�k�e�t�=�=�m�_�d�e�a�l�.�O�r�d�e�r�(�)�)�
�
� � � � � � � � � � � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � � � � � � � � � � �P�r�i�n�t�(�_�_�F�U�N�C�T�I�O�N�_�_�,�"� �T�r�a�n�s�a�c�t�i�o�n� �c�o�n�f�i�r�m�e�d�"�)�;�
�
� � � � � � � � � � � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�]�.�t�r�a�n�s�a�c�t�i�o�n�_�c�o�n�f�i�r�m�e�d�=�t�r�u�e�;�
�
� � � � � � � � � � � � � � � � � � � � � � � � �b�r�e�a�k�;�
�
� � � � � � � � � � � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � �}�
�
� � � � � � � � �}�
�
� � � � � �}�
�
� � �}�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �R�e�f�r�e�s�h�e�s� �t�h�e� �s�y�m�b�o�l� �q�u�o�t�e�s� �d�a�t�a� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�b�o�o�l� �R�e�f�r�e�s�h�R�a�t�e�s�(�)�
�
� � �{�
�
�/�/�-�-�-� �r�e�f�r�e�s�h� �r�a�t�e�s�
�
� � � �i�f�(�!�m�_�s�y�m�b�o�l�.�R�e�f�r�e�s�h�R�a�t�e�s�(�)�)�
�
� � � � � �{�
�
� � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�"�R�e�f�r�e�s�h�R�a�t�e�s� �e�r�r�o�r�"�)�;�
�
� � � � � � �r�e�t�u�r�n�(�f�a�l�s�e�)�;�
�
� � � � � �}�
�
�/�/�-�-�-� �p�r�o�t�e�c�t�i�o�n� �a�g�a�i�n�s�t� �t�h�e� �r�e�t�u�r�n� �v�a�l�u�e� �o�f� �"�z�e�r�o�"�
�
� � � �i�f�(�m�_�s�y�m�b�o�l�.�A�s�k�(�)�=�=�0� �|�|� �m�_�s�y�m�b�o�l�.�B�i�d�(�)�=�=�0�)�
�
� � � � � �{�
�
� � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�"�A�s�k� �=�=� �0�.�0� �O�R� �B�i�d� �=�=� �0�.�0�"�)�;�
�
� � � � � � �r�e�t�u�r�n�(�f�a�l�s�e�)�;�
�
� � � � � �}�
�
�/�/�-�-�-�
�
� � � �r�e�t�u�r�n�(�t�r�u�e�)�;�
�
� � �}�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �C�h�e�c�k� �t�h�e� �c�o�r�r�e�c�t�n�e�s�s� �o�f� �t�h�e� �p�o�s�i�t�i�o�n� �v�o�l�u�m�e� � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�b�o�o�l� �C�h�e�c�k�V�o�l�u�m�e�V�a�l�u�e�(�d�o�u�b�l�e� �v�o�l�u�m�e�,�s�t�r�i�n�g� �&�e�r�r�o�r�_�d�e�s�c�r�i�p�t�i�o�n�)�
�
� � �{�
�
�/�/�-�-�-� �m�i�n�i�m�a�l� �a�l�l�o�w�e�d� �v�o�l�u�m�e� �f�o�r� �t�r�a�d�e� �o�p�e�r�a�t�i�o�n�s�
�
� � � �d�o�u�b�l�e� �m�i�n�_�v�o�l�u�m�e�=�m�_�s�y�m�b�o�l�.�L�o�t�s�M�i�n�(�)�;�
�
� � � �i�f�(�v�o�l�u�m�e�<�m�i�n�_�v�o�l�u�m�e�)�
�
� � � � � �{�
�
� � � � � � �i�f�(�T�e�r�m�i�n�a�l�I�n�f�o�S�t�r�i�n�g�(�T�E�R�M�I�N�A�L�_�L�A�N�G�U�A�G�E�)�=�=�"�R�u�s�s�i�a�n�"�)�
�
� � � � � � � � � �e�r�r�o�r�_�d�e�s�c�r�i�p�t�i�o�n�=�S�t�r�i�n�g�F�o�r�m�a�t�(�"�1J5< �<5=LH5 �<8=8<0;L=> �4>?CAB8<>3> �S�Y�M�B�O�L�_�V�O�L�U�M�E�_�M�I�N�=�%�.�2�f�"�,�m�i�n�_�v�o�l�u�m�e�)�;�
�
� � � � � � �e�l�s�e�
�
� � � � � � � � � �e�r�r�o�r�_�d�e�s�c�r�i�p�t�i�o�n�=�S�t�r�i�n�g�F�o�r�m�a�t�(�"�V�o�l�u�m�e� �i�s� �l�e�s�s� �t�h�a�n� �t�h�e� �m�i�n�i�m�a�l� �a�l�l�o�w�e�d� �S�Y�M�B�O�L�_�V�O�L�U�M�E�_�M�I�N�=�%�.�2�f�"�,�m�i�n�_�v�o�l�u�m�e�)�;�
�
� � � � � � �r�e�t�u�r�n�(�f�a�l�s�e�)�;�
�
� � � � � �}�
�
�/�/�-�-�-� �m�a�x�i�m�a�l� �a�l�l�o�w�e�d� �v�o�l�u�m�e� �o�f� �t�r�a�d�e� �o�p�e�r�a�t�i�o�n�s�
�
� � � �d�o�u�b�l�e� �m�a�x�_�v�o�l�u�m�e�=�m�_�s�y�m�b�o�l�.�L�o�t�s�M�a�x�(�)�;�
�
� � � �i�f�(�v�o�l�u�m�e�>�m�a�x�_�v�o�l�u�m�e�)�
�
� � � � � �{�
�
� � � � � � �i�f�(�T�e�r�m�i�n�a�l�I�n�f�o�S�t�r�i�n�g�(�T�E�R�M�I�N�A�L�_�L�A�N�G�U�A�G�E�)�=�=�"�R�u�s�s�i�a�n�"�)�
�
� � � � � � � � � �e�r�r�o�r�_�d�e�s�c�r�i�p�t�i�o�n�=�S�t�r�i�n�g�F�o�r�m�a�t�(�"�1J5< �1>;LH5 �<0:A8<0;L=> �4>?CAB8<>3> �S�Y�M�B�O�L�_�V�O�L�U�M�E�_�M�A�X�=�%�.�2�f�"�,�m�a�x�_�v�o�l�u�m�e�)�;�
�
� � � � � � �e�l�s�e�
�
� � � � � � � � � �e�r�r�o�r�_�d�e�s�c�r�i�p�t�i�o�n�=�S�t�r�i�n�g�F�o�r�m�a�t�(�"�V�o�l�u�m�e� �i�s� �g�r�e�a�t�e�r� �t�h�a�n� �t�h�e� �m�a�x�i�m�a�l� �a�l�l�o�w�e�d� �S�Y�M�B�O�L�_�V�O�L�U�M�E�_�M�A�X�=�%�.�2�f�"�,�m�a�x�_�v�o�l�u�m�e�)�;�
�
� � � � � � �r�e�t�u�r�n�(�f�a�l�s�e�)�;�
�
� � � � � �}�
�
�/�/�-�-�-� �g�e�t� �m�i�n�i�m�a�l� �s�t�e�p� �o�f� �v�o�l�u�m�e� �c�h�a�n�g�i�n�g�
�
� � � �d�o�u�b�l�e� �v�o�l�u�m�e�_�s�t�e�p�=�m�_�s�y�m�b�o�l�.�L�o�t�s�S�t�e�p�(�)�;�
�
� � � �i�n�t� �r�a�t�i�o�=�(�i�n�t�)�M�a�t�h�R�o�u�n�d�(�v�o�l�u�m�e�/�v�o�l�u�m�e�_�s�t�e�p�)�;�
�
� � � �i�f�(�M�a�t�h�A�b�s�(�r�a�t�i�o�*�v�o�l�u�m�e�_�s�t�e�p�-�v�o�l�u�m�e�)�>�0�.�0�0�0�0�0�0�1�)�
�
� � � � � �{�
�
� � � � � � �i�f�(�T�e�r�m�i�n�a�l�I�n�f�o�S�t�r�i�n�g�(�T�E�R�M�I�N�A�L�_�L�A�N�G�U�A�G�E�)�=�=�"�R�u�s�s�i�a�n�"�)�
�
� � � � � � � � � �e�r�r�o�r�_�d�e�s�c�r�i�p�t�i�o�n�=�S�t�r�i�n�g�F�o�r�m�a�t�(�"�1J5< �=5 �:@0B5= �<8=8<0;L=><C �H03C �S�Y�M�B�O�L�_�V�O�L�U�M�E�_�S�T�E�P�=�%�.�2�f�,� �1;8609H89 �?@028;L=K9 �>1J5< �%�.�2�f�"�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �v�o�l�u�m�e�_�s�t�e�p�,�r�a�t�i�o�*�v�o�l�u�m�e�_�s�t�e�p�)�;�
�
� � � � � � �e�l�s�e�
�
� � � � � � � � � �e�r�r�o�r�_�d�e�s�c�r�i�p�t�i�o�n�=�S�t�r�i�n�g�F�o�r�m�a�t�(�"�V�o�l�u�m�e� �i�s� �n�o�t� �a� �m�u�l�t�i�p�l�e� �o�f� �t�h�e� �m�i�n�i�m�a�l� �s�t�e�p� �S�Y�M�B�O�L�_�V�O�L�U�M�E�_�S�T�E�P�=�%�.�2�f�,� �t�h�e� �c�l�o�s�e�s�t� �c�o�r�r�e�c�t� �v�o�l�u�m�e� �i�s� �%�.�2�f�"�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �v�o�l�u�m�e�_�s�t�e�p�,�r�a�t�i�o�*�v�o�l�u�m�e�_�s�t�e�p�)�;�
�
� � � � � � �r�e�t�u�r�n�(�f�a�l�s�e�)�;�
�
� � � � � �}�
�
� � � �e�r�r�o�r�_�d�e�s�c�r�i�p�t�i�o�n�=�"�C�o�r�r�e�c�t� �v�o�l�u�m�e� �v�a�l�u�e�"�;�
�
�/�/�-�-�-�
�
� � � �r�e�t�u�r�n�(�t�r�u�e�)�;�
�
� � �}�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �O�p�e�n� �p�o�s�i�t�i�o�n� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�v�o�i�d� �O�p�e�n�P�o�s�i�t�i�o�n�(�c�o�n�s�t� �i�n�t� �i�n�d�e�x�)�
�
� � �{�
�
� � � �i�f�(�!�R�e�f�r�e�s�h�R�a�t�e�s�(�)�)�
�
� � � � � � �r�e�t�u�r�n�;�
�
�/�/�-�-�-� �b�u�y�
�
� � � �i�f�(�S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�p�o�s�_�t�y�p�e�=�=�P�O�S�I�T�I�O�N�_�T�Y�P�E�_�B�U�Y�)�
�
� � � � � �{�
�
� � � � � � �O�p�e�n�B�u�y�(�i�n�d�e�x�)�;�
�
� � � � � � �r�e�t�u�r�n�;�
�
� � � � � �}�
�
�/�/�-�-�-� �s�e�l�l�
�
� � � �i�f�(�S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�p�o�s�_�t�y�p�e�=�=�P�O�S�I�T�I�O�N�_�T�Y�P�E�_�S�E�L�L�)�
�
� � � � � �{�
�
� � � � � � �O�p�e�n�S�e�l�l�(�i�n�d�e�x�)�;�
�
� � � � � � �r�e�t�u�r�n�;�
�
� � � � � �}�
�
� � �}�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �O�p�e�n� �B�u�y� �p�o�s�i�t�i�o�n� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�v�o�i�d� �O�p�e�n�B�u�y�(�c�o�n�s�t� �i�n�t� �i�n�d�e�x�)�
�
� � �{�
�
� � � �d�o�u�b�l�e� �s�l�=�0�.�0�;�
�
� � � �d�o�u�b�l�e� �t�p�=�0�.�0�;�
�
� � � �d�o�u�b�l�e� �l�o�n�g�_�l�o�t�=�I�n�p�L�o�t�s�;�
�
�/�/�-�-�-�
�
� � � �i�f�(�m�_�s�y�m�b�o�l�.�L�o�t�s�L�i�m�i�t�(�)�>�0�.�0�)�
�
� � � � � �{�
�
� � � � � � �i�n�t� � � � � � �c�o�u�n�t�_�b�u�y�s� � � � � � � � � � � �=� �0�;�
�
� � � � � � �d�o�u�b�l�e� � � �v�o�l�u�m�e�_�b�u�y�s� � � � � � � � � � �=� �0�.�0�;�
�
� � � � � � �d�o�u�b�l�e� � � �v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�b�u�y�s� � �=� �0�.�0�;�
�
� � � � � � �i�n�t� � � � � � �c�o�u�n�t�_�s�e�l�l�s� � � � � � � � � � �=� �0�;�
�
� � � � � � �d�o�u�b�l�e� � � �v�o�l�u�m�e�_�s�e�l�l�s� � � � � � � � � �=� �0�.�0�;�
�
� � � � � � �d�o�u�b�l�e� � � �v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�s�e�l�l�s� �=� �0�.�0�;�
�
� � � � � � �C�a�l�c�u�l�a�t�e�A�l�l�P�o�s�i�t�i�o�n�s�(�c�o�u�n�t�_�b�u�y�s�,�v�o�l�u�m�e�_�b�u�y�s�,�v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�b�u�y�s�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � �c�o�u�n�t�_�s�e�l�l�s�,�v�o�l�u�m�e�_�s�e�l�l�s�,�v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�s�e�l�l�s�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � �t�r�u�e�)�;�
�
� � � � � � �i�f�(�v�o�l�u�m�e�_�b�u�y�s�+�v�o�l�u�m�e�_�s�e�l�l�s�+�l�o�n�g�_�l�o�t�>�m�_�s�y�m�b�o�l�.�L�o�t�s�L�i�m�i�t�(�)�)�
�
� � � � � � � � �{�
�
� � � � � � � � � �A�r�r�a�y�R�e�m�o�v�e�(�S�P�o�s�i�t�i�o�n�,�i�n�d�e�x�,�1�)�;�
�
� � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�"�#�0� �B�u�y�,� �V�o�l�u�m�e� �B�u�y� �(�"�,�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�v�o�l�u�m�e�_�b�u�y�s�,�2�)�,�
�
� � � � � � � � � � � � � � � � � � �"�)� �+� �V�o�l�u�m�e� �S�e�l�l� �(�"�,�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�v�o�l�u�m�e�_�s�e�l�l�s�,�2�)�,�
�
� � � � � � � � � � � � � � � � � � �"�)� �+� �V�o�l�u�m�e� �l�o�n�g� �(�"�,�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�l�o�n�g�_�l�o�t�,�2�)�,�
�
� � � � � � � � � � � � � � � � � � �"�)� �>� �L�o�t�s� �L�i�m�i�t� �(�"�,�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�m�_�s�y�m�b�o�l�.�L�o�t�s�L�i�m�i�t�(�)�,�2�)�,�"�)�"�)�;�
�
� � � � � � � � � �r�e�t�u�r�n�;�
�
� � � � � � � � �}�
�
� � � � � �}�
�
�/�/�-�-�-� �c�h�e�c�k� �v�o�l�u�m�e� �b�e�f�o�r�e� �O�r�d�e�r�S�e�n�d� �t�o� �a�v�o�i�d� �"�n�o�t� �e�n�o�u�g�h� �m�o�n�e�y�"� �e�r�r�o�r� �(�C�T�r�a�d�e�)�
�
� � � �d�o�u�b�l�e� �f�r�e�e�_�m�a�r�g�i�n�_�c�h�e�c�k�=�m�_�a�c�c�o�u�n�t�.�F�r�e�e�M�a�r�g�i�n�C�h�e�c�k�(�m�_�s�y�m�b�o�l�.�N�a�m�e�(�)�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � �O�R�D�E�R�_�T�Y�P�E�_�B�U�Y�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � �l�o�n�g�_�l�o�t�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � �m�_�s�y�m�b�o�l�.�A�s�k�(�)�)�;�
�
� � � �d�o�u�b�l�e� �m�a�r�g�i�n�_�c�h�e�c�k�=�m�_�a�c�c�o�u�n�t�.�M�a�r�g�i�n�C�h�e�c�k�(�m�_�s�y�m�b�o�l�.�N�a�m�e�(�)�,�
�
� � � � � � � � � � � � � � � � � � � � � � � �O�R�D�E�R�_�T�Y�P�E�_�B�U�Y�,�
�
� � � � � � � � � � � � � � � � � � � � � � � �l�o�n�g�_�l�o�t�,�
�
� � � � � � � � � � � � � � � � � � � � � � � �m�_�s�y�m�b�o�l�.�A�s�k�(�)�)�;�
�
� � � �i�f�(�f�r�e�e�_�m�a�r�g�i�n�_�c�h�e�c�k�>�m�a�r�g�i�n�_�c�h�e�c�k�)�
�
� � � � � �{�
�
� � � � � � �i�f�(�m�_�t�r�a�d�e�.�B�u�y�(�l�o�n�g�_�l�o�t�,�m�_�s�y�m�b�o�l�.�N�a�m�e�(�)�,�m�_�s�y�m�b�o�l�.�A�s�k�(�)�,�s�l�,�t�p�)�)� �/�/� �C�T�r�a�d�e�:�:�B�u�y� �-�>� �"�t�r�u�e�"�
�
� � � � � � � � �{�
�
� � � � � � � � � �i�f�(�m�_�t�r�a�d�e�.�R�e�s�u�l�t�D�e�a�l�(�)�=�=�0�)�
�
� � � � � � � � � � � �{�
�
� � � � � � � � � � � � �i�f�(�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�(�)�=�=�1�0�0�0�9�)� �/�/� �t�r�a�d�e� �o�r�d�e�r� �w�e�n�t� �t�o� �t�h�e� �e�x�c�h�a�n�g�e�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�=�t�r�u�e�;�
�
� � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�w�a�i�t�i�n�g�_�o�r�d�e�r�_�t�i�c�k�e�t�=�m�_�t�r�a�d�e�.�R�e�s�u�l�t�O�r�d�e�r�(�)�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �e�l�s�e�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�=�f�a�l�s�e�;�
�
� � � � � � � � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�"�#�1� �B�u�y� �-�>� �f�a�l�s�e�.� �R�e�s�u�l�t� �R�e�t�c�o�d�e�:� �"�,�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�(�)�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � �"�,� �d�e�s�c�r�i�p�t�i�o�n� �o�f� �r�e�s�u�l�t�:� �"�,�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�D�e�s�c�r�i�p�t�i�o�n�(�)�)�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � � � � �P�r�i�n�t�R�e�s�u�l�t�T�r�a�d�e�(�m�_�t�r�a�d�e�,�m�_�s�y�m�b�o�l�)�;�
�
� � � � � � � � � � � �}�
�
� � � � � � � � � �e�l�s�e�
�
� � � � � � � � � � � �{�
�
� � � � � � � � � � � � �i�f�(�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�(�)�=�=�1�0�0�0�9�)�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�=�t�r�u�e�;�
�
� � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�w�a�i�t�i�n�g�_�o�r�d�e�r�_�t�i�c�k�e�t�=�m�_�t�r�a�d�e�.�R�e�s�u�l�t�O�r�d�e�r�(�)�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �e�l�s�e�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�=�f�a�l�s�e�;�
�
� � � � � � � � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �O�K�:� �"�,�"�#�2� �B�u�y� �-�>� �t�r�u�e�.� �R�e�s�u�l�t� �R�e�t�c�o�d�e�:� �"�,�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�(�)�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � �"�,� �d�e�s�c�r�i�p�t�i�o�n� �o�f� �r�e�s�u�l�t�:� �"�,�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�D�e�s�c�r�i�p�t�i�o�n�(�)�)�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � � � � �P�r�i�n�t�R�e�s�u�l�t�T�r�a�d�e�(�m�_�t�r�a�d�e�,�m�_�s�y�m�b�o�l�)�;�
�
� � � � � � � � � � � �}�
�
� � � � � � � � �}�
�
� � � � � � �e�l�s�e�
�
� � � � � � � � �{�
�
� � � � � � � � � �/�*�
�
� � � � � � � � � �1�0�0�1�8� �T�R�A�D�E�_�R�E�T�C�O�D�E�_�M�A�R�K�E�T�_�C�L�O�S�E�D� � � �M�a�r�k�e�t� �i�s� �c�l�o�s�e�d�
�
� � � � � � � � � �1�0�0�2�6� �T�R�A�D�E�_�R�E�T�C�O�D�E�_�S�E�R�V�E�R�_�D�I�S�A�B�L�E�S�_�A�T� �A�u�t�o�t�r�a�d�i�n�g� �d�i�s�a�b�l�e�d� �b�y� �s�e�r�v�e�r�
�
� � � � � � � � � �1�0�0�2�7� �T�R�A�D�E�_�R�E�T�C�O�D�E�_�C�L�I�E�N�T�_�D�I�S�A�B�L�E�S�_�A�T� �A�u�t�o�t�r�a�d�i�n�g� �d�i�s�a�b�l�e�d� �b�y� �c�l�i�e�n�t� �t�e�r�m�i�n�a�l�
�
� � � � � � � � � �1�0�0�4�3� �T�R�A�D�E�_�R�E�T�C�O�D�E�_�S�H�O�R�T�_�O�N�L�Y� � � �T�h�e� �r�e�q�u�e�s�t� �i�s� �r�e�j�e�c�t�e�d�,� �b�e�c�a�u�s�e� �t�h�e� �"�O�n�l�y� �s�h�o�r�t� �p�o�s�i�t�i�o�n�s� �a�r�e� �a�l�l�o�w�e�d�"� �r�u�l�e� �i�s� �s�e�t� �f�o�r� �t�h�e� �s�y�m�b�o�l� �(�P�O�S�I�T�I�O�N�_�T�Y�P�E�_�S�E�L�L�)�
�
� � � � � � � � � �1�0�0�4�4� �T�R�A�D�E�_�R�E�T�C�O�D�E�_�C�L�O�S�E�_�O�N�L�Y� � � �T�h�e� �r�e�q�u�e�s�t� �i�s� �r�e�j�e�c�t�e�d�,� �b�e�c�a�u�s�e� �t�h�e� �"�O�n�l�y� �p�o�s�i�t�i�o�n� �c�l�o�s�i�n�g� �i�s� �a�l�l�o�w�e�d�"� �r�u�l�e� �i�s� �s�e�t� �f�o�r� �t�h�e� �s�y�m�b�o�l�
�
� � � � � � � � � �*�/�
�
� � � � � � � � � �u�i�n�t� �r�e�s�u�l�t�_�r�e�t�c�o�d�e�=�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�(�)�;�
�
� � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�=�f�a�l�s�e�;�
�
� � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�"�#�3� �B�u�y� �-�>� �f�a�l�s�e�.� �R�e�s�u�l�t� �R�e�t�c�o�d�e�:� �"�,�r�e�s�u�l�t�_�r�e�t�c�o�d�e�,�
�
� � � � � � � � � � � � � � � � � � �"�,� �d�e�s�c�r�i�p�t�i�o�n� �o�f� �r�e�s�u�l�t�:� �"�,�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�D�e�s�c�r�i�p�t�i�o�n�(�)�)�;�
�
� � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � �P�r�i�n�t�R�e�s�u�l�t�T�r�a�d�e�(�m�_�t�r�a�d�e�,�m�_�s�y�m�b�o�l�)�;�
�
� � � � � � � � � �i�f�(�r�e�s�u�l�t�_�r�e�t�c�o�d�e�=�=�1�0�0�1�8� �|�|� �r�e�s�u�l�t�_�r�e�t�c�o�d�e�=�=�1�0�0�2�6� �|�|� �r�e�s�u�l�t�_�r�e�t�c�o�d�e�=�=�1�0�0�2�7� �|�|� �r�e�s�u�l�t�_�r�e�t�c�o�d�e�=�=�1�0�0�4�3� �|�|� �r�e�s�u�l�t�_�r�e�t�c�o�d�e�=�=�1�0�0�4�4�)�
�
� � � � � � � � � � � � �A�r�r�a�y�R�e�m�o�v�e�(�S�P�o�s�i�t�i�o�n�,�i�n�d�e�x�,�1�)�;�
�
� � � � � � � � �}�
�
� � � � � �}�
�
� � � �e�l�s�e�
�
� � � � � �{�
�
� � � � � � �A�r�r�a�y�R�e�m�o�v�e�(�S�P�o�s�i�t�i�o�n�,�i�n�d�e�x�,�1�)�;�
�
� � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�"�F�r�e�e� �M�a�r�g�i�n� �C�h�e�c�k� �(�"�,�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�f�r�e�e�_�m�a�r�g�i�n�_�c�h�e�c�k�,�2�)�,�"�)� �<�=� �M�a�r�g�i�n� �C�h�e�c�k� �(�"�,�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�m�a�r�g�i�n�_�c�h�e�c�k�,�2�)�,�"�)�"�)�;�
�
� � � � � � �r�e�t�u�r�n�;�
�
� � � � � �}�
�
�/�/�-�-�-�
�
� � �}�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �O�p�e�n� �S�e�l�l� �p�o�s�i�t�i�o�n� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�v�o�i�d� �O�p�e�n�S�e�l�l�(�c�o�n�s�t� �i�n�t� �i�n�d�e�x�)�
�
� � �{�
�
� � � �d�o�u�b�l�e� �s�l�=�0�.�0�;�
�
� � � �d�o�u�b�l�e� �t�p�=�0�.�0�;�
�
� � � �d�o�u�b�l�e� �s�h�o�r�t�_�l�o�t�=�I�n�p�L�o�t�s�;�
�
�/�/�-�-�-�
�
� � � �i�f�(�m�_�s�y�m�b�o�l�.�L�o�t�s�L�i�m�i�t�(�)�>�0�.�0�)�
�
� � � � � �{�
�
� � � � � � �i�n�t� � � � � � �c�o�u�n�t�_�b�u�y�s� � � � � � � � � � � �=� �0�;�
�
� � � � � � �d�o�u�b�l�e� � � �v�o�l�u�m�e�_�b�u�y�s� � � � � � � � � � �=� �0�.�0�;�
�
� � � � � � �d�o�u�b�l�e� � � �v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�b�u�y�s� � �=� �0�.�0�;�
�
� � � � � � �i�n�t� � � � � � �c�o�u�n�t�_�s�e�l�l�s� � � � � � � � � � �=� �0�;�
�
� � � � � � �d�o�u�b�l�e� � � �v�o�l�u�m�e�_�s�e�l�l�s� � � � � � � � � �=� �0�.�0�;�
�
� � � � � � �d�o�u�b�l�e� � � �v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�s�e�l�l�s� �=� �0�.�0�;�
�
� � � � � � �C�a�l�c�u�l�a�t�e�A�l�l�P�o�s�i�t�i�o�n�s�(�c�o�u�n�t�_�b�u�y�s�,�v�o�l�u�m�e�_�b�u�y�s�,�v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�b�u�y�s�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � �c�o�u�n�t�_�s�e�l�l�s�,�v�o�l�u�m�e�_�s�e�l�l�s�,�v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�s�e�l�l�s�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � �t�r�u�e�)�;�
�
� � � � � � �i�f�(�v�o�l�u�m�e�_�b�u�y�s�+�v�o�l�u�m�e�_�s�e�l�l�s�+�s�h�o�r�t�_�l�o�t�>�m�_�s�y�m�b�o�l�.�L�o�t�s�L�i�m�i�t�(�)�)�
�
� � � � � � � � �{�
�
� � � � � � � � � �A�r�r�a�y�R�e�m�o�v�e�(�S�P�o�s�i�t�i�o�n�,�i�n�d�e�x�,�1�)�;�
�
� � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�"�#�0� �B�u�y�,� �V�o�l�u�m�e� �B�u�y� �(�"�,�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�v�o�l�u�m�e�_�b�u�y�s�,�2�)�,�
�
� � � � � � � � � � � � � � � � � � �"�)� �+� �V�o�l�u�m�e� �S�e�l�l� �(�"�,�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�v�o�l�u�m�e�_�s�e�l�l�s�,�2�)�,�
�
� � � � � � � � � � � � � � � � � � �"�)� �+� �V�o�l�u�m�e� �s�h�o�r�t� �(�"�,�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�s�h�o�r�t�_�l�o�t�,�2�)�,�
�
� � � � � � � � � � � � � � � � � � �"�)� �>� �L�o�t�s� �L�i�m�i�t� �(�"�,�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�m�_�s�y�m�b�o�l�.�L�o�t�s�L�i�m�i�t�(�)�,�2�)�,�"�)�"�)�;�
�
� � � � � � � � � �r�e�t�u�r�n�;�
�
� � � � � � � � �}�
�
� � � � � �}�
�
�/�/�-�-�-� �c�h�e�c�k� �v�o�l�u�m�e� �b�e�f�o�r�e� �O�r�d�e�r�S�e�n�d� �t�o� �a�v�o�i�d� �"�n�o�t� �e�n�o�u�g�h� �m�o�n�e�y�"� �e�r�r�o�r� �(�C�T�r�a�d�e�)�
�
� � � �d�o�u�b�l�e� �f�r�e�e�_�m�a�r�g�i�n�_�c�h�e�c�k�=�m�_�a�c�c�o�u�n�t�.�F�r�e�e�M�a�r�g�i�n�C�h�e�c�k�(�m�_�s�y�m�b�o�l�.�N�a�m�e�(�)�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � �O�R�D�E�R�_�T�Y�P�E�_�S�E�L�L�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � �s�h�o�r�t�_�l�o�t�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � � �m�_�s�y�m�b�o�l�.�B�i�d�(�)�)�;�
�
� � � �d�o�u�b�l�e� �m�a�r�g�i�n�_�c�h�e�c�k�=�m�_�a�c�c�o�u�n�t�.�M�a�r�g�i�n�C�h�e�c�k�(�m�_�s�y�m�b�o�l�.�N�a�m�e�(�)�,�
�
� � � � � � � � � � � � � � � � � � � � � � � �O�R�D�E�R�_�T�Y�P�E�_�S�E�L�L�,�
�
� � � � � � � � � � � � � � � � � � � � � � � �s�h�o�r�t�_�l�o�t�,�
�
� � � � � � � � � � � � � � � � � � � � � � � �m�_�s�y�m�b�o�l�.�B�i�d�(�)�)�;�
�
� � � �i�f�(�f�r�e�e�_�m�a�r�g�i�n�_�c�h�e�c�k�>�m�a�r�g�i�n�_�c�h�e�c�k�)�
�
� � � � � �{�
�
� � � � � � �i�f�(�m�_�t�r�a�d�e�.�S�e�l�l�(�s�h�o�r�t�_�l�o�t�,�m�_�s�y�m�b�o�l�.�N�a�m�e�(�)�,�m�_�s�y�m�b�o�l�.�B�i�d�(�)�,�s�l�,�t�p�)�)� �/�/� �C�T�r�a�d�e�:�:�S�e�l�l� �-�>� �"�t�r�u�e�"�
�
� � � � � � � � �{�
�
� � � � � � � � � �i�f�(�m�_�t�r�a�d�e�.�R�e�s�u�l�t�D�e�a�l�(�)�=�=�0�)�
�
� � � � � � � � � � � �{�
�
� � � � � � � � � � � � �i�f�(�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�(�)�=�=�1�0�0�0�9�)� �/�/� �t�r�a�d�e� �o�r�d�e�r� �w�e�n�t� �t�o� �t�h�e� �e�x�c�h�a�n�g�e�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�=�t�r�u�e�;�
�
� � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�w�a�i�t�i�n�g�_�o�r�d�e�r�_�t�i�c�k�e�t�=�m�_�t�r�a�d�e�.�R�e�s�u�l�t�O�r�d�e�r�(�)�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �e�l�s�e�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�=�f�a�l�s�e�;�
�
� � � � � � � � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�"�#�1� �S�e�l�l� �-�>� �f�a�l�s�e�.� �R�e�s�u�l�t� �R�e�t�c�o�d�e�:� �"�,�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�(�)�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � �"�,� �d�e�s�c�r�i�p�t�i�o�n� �o�f� �r�e�s�u�l�t�:� �"�,�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�D�e�s�c�r�i�p�t�i�o�n�(�)�)�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � � � � �P�r�i�n�t�R�e�s�u�l�t�T�r�a�d�e�(�m�_�t�r�a�d�e�,�m�_�s�y�m�b�o�l�)�;�
�
� � � � � � � � � � � �}�
�
� � � � � � � � � �e�l�s�e�
�
� � � � � � � � � � � �{�
�
� � � � � � � � � � � � �i�f�(�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�(�)�=�=�1�0�0�0�9�)�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�=�t�r�u�e�;�
�
� � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�w�a�i�t�i�n�g�_�o�r�d�e�r�_�t�i�c�k�e�t�=�m�_�t�r�a�d�e�.�R�e�s�u�l�t�O�r�d�e�r�(�)�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �e�l�s�e�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�=�f�a�l�s�e�;�
�
� � � � � � � � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �O�K�:� �"�,�"�#�2� �S�e�l�l� �-�>� �t�r�u�e�.� �R�e�s�u�l�t� �R�e�t�c�o�d�e�:� �"�,�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�(�)�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � �"�,� �d�e�s�c�r�i�p�t�i�o�n� �o�f� �r�e�s�u�l�t�:� �"�,�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�D�e�s�c�r�i�p�t�i�o�n�(�)�)�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � � � � �P�r�i�n�t�R�e�s�u�l�t�T�r�a�d�e�(�m�_�t�r�a�d�e�,�m�_�s�y�m�b�o�l�)�;�
�
� � � � � � � � � � � �}�
�
� � � � � � � � �}�
�
� � � � � � �e�l�s�e�
�
� � � � � � � � �{�
�
� � � � � � � � � �/�*�
�
� � � � � � � � � �1�0�0�1�8� �T�R�A�D�E�_�R�E�T�C�O�D�E�_�M�A�R�K�E�T�_�C�L�O�S�E�D� � � �M�a�r�k�e�t� �i�s� �c�l�o�s�e�d�
�
� � � � � � � � � �1�0�0�2�6� �T�R�A�D�E�_�R�E�T�C�O�D�E�_�S�E�R�V�E�R�_�D�I�S�A�B�L�E�S�_�A�T� �A�u�t�o�t�r�a�d�i�n�g� �d�i�s�a�b�l�e�d� �b�y� �s�e�r�v�e�r�
�
� � � � � � � � � �1�0�0�2�7� �T�R�A�D�E�_�R�E�T�C�O�D�E�_�C�L�I�E�N�T�_�D�I�S�A�B�L�E�S�_�A�T� �A�u�t�o�t�r�a�d�i�n�g� �d�i�s�a�b�l�e�d� �b�y� �c�l�i�e�n�t� �t�e�r�m�i�n�a�l�
�
� � � � � � � � � �1�0�0�4�3� �T�R�A�D�E�_�R�E�T�C�O�D�E�_�S�H�O�R�T�_�O�N�L�Y� � � �T�h�e� �r�e�q�u�e�s�t� �i�s� �r�e�j�e�c�t�e�d�,� �b�e�c�a�u�s�e� �t�h�e� �"�O�n�l�y� �s�h�o�r�t� �p�o�s�i�t�i�o�n�s� �a�r�e� �a�l�l�o�w�e�d�"� �r�u�l�e� �i�s� �s�e�t� �f�o�r� �t�h�e� �s�y�m�b�o�l� �(�P�O�S�I�T�I�O�N�_�T�Y�P�E�_�S�E�L�L�)�
�
� � � � � � � � � �1�0�0�4�4� �T�R�A�D�E�_�R�E�T�C�O�D�E�_�C�L�O�S�E�_�O�N�L�Y� � � �T�h�e� �r�e�q�u�e�s�t� �i�s� �r�e�j�e�c�t�e�d�,� �b�e�c�a�u�s�e� �t�h�e� �"�O�n�l�y� �p�o�s�i�t�i�o�n� �c�l�o�s�i�n�g� �i�s� �a�l�l�o�w�e�d�"� �r�u�l�e� �i�s� �s�e�t� �f�o�r� �t�h�e� �s�y�m�b�o�l�
�
� � � � � � � � � �*�/�
�
� � � � � � � � � �u�i�n�t� �r�e�s�u�l�t�_�r�e�t�c�o�d�e�=�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�(�)�;�
�
� � � � � � � � � �S�P�o�s�i�t�i�o�n�[�i�n�d�e�x�]�.�w�a�i�t�i�n�g�_�t�r�a�n�s�a�c�t�i�o�n�=�f�a�l�s�e�;�
�
� � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�"�#�3� �S�e�l�l� �-�>� �f�a�l�s�e�.� �R�e�s�u�l�t� �R�e�t�c�o�d�e�:� �"�,�r�e�s�u�l�t�_�r�e�t�c�o�d�e�,�
�
� � � � � � � � � � � � � � � � � � �"�,� �d�e�s�c�r�i�p�t�i�o�n� �o�f� �r�e�s�u�l�t�:� �"�,�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�D�e�s�c�r�i�p�t�i�o�n�(�)�)�;�
�
� � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � �P�r�i�n�t�R�e�s�u�l�t�T�r�a�d�e�(�m�_�t�r�a�d�e�,�m�_�s�y�m�b�o�l�)�;�
�
� � � � � � � � � �i�f�(�r�e�s�u�l�t�_�r�e�t�c�o�d�e�=�=�1�0�0�1�8� �|�|� �r�e�s�u�l�t�_�r�e�t�c�o�d�e�=�=�1�0�0�2�6� �|�|� �r�e�s�u�l�t�_�r�e�t�c�o�d�e�=�=�1�0�0�2�7� �|�|� �r�e�s�u�l�t�_�r�e�t�c�o�d�e�=�=�1�0�0�4�3� �|�|� �r�e�s�u�l�t�_�r�e�t�c�o�d�e�=�=�1�0�0�4�4�)�
�
� � � � � � � � � � � � �A�r�r�a�y�R�e�m�o�v�e�(�S�P�o�s�i�t�i�o�n�,�i�n�d�e�x�,�1�)�;�
�
� � � � � � � � �}�
�
� � � � � �}�
�
� � � �e�l�s�e�
�
� � � � � �{�
�
� � � � � � �A�r�r�a�y�R�e�m�o�v�e�(�S�P�o�s�i�t�i�o�n�,�i�n�d�e�x�,�1�)�;�
�
� � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�"�F�r�e�e� �M�a�r�g�i�n� �C�h�e�c�k� �(�"�,�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�f�r�e�e�_�m�a�r�g�i�n�_�c�h�e�c�k�,�2�)�,�"�)� �<�=� �M�a�r�g�i�n� �C�h�e�c�k� �(�"�,�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�m�a�r�g�i�n�_�c�h�e�c�k�,�2�)�,�"�)�"�)�;�
�
� � � � � � �r�e�t�u�r�n�;�
�
� � � � � �}�
�
�/�/�-�-�-�
�
� � �}�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �P�r�i�n�t� �C�T�r�a�d�e� �r�e�s�u�l�t� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�v�o�i�d� �P�r�i�n�t�R�e�s�u�l�t�T�r�a�d�e�(�C�T�r�a�d�e� �&�t�r�a�d�e�,�C�S�y�m�b�o�l�I�n�f�o� �&�s�y�m�b�o�l�)�
�
� � �{�
�
� � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �S�y�m�b�o�l�:� �"�,�s�y�m�b�o�l�.�N�a�m�e�(�)�+�"�,� �"�+�
�
� � � � � � � � � �"�C�o�d�e� �o�f� �r�e�q�u�e�s�t� �r�e�s�u�l�t�:� �"�+�I�n�t�e�g�e�r�T�o�S�t�r�i�n�g�(�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�(�)�)�+�"�,� �"�+�
�
� � � � � � � � � �"�C�o�d�e� �o�f� �r�e�q�u�e�s�t� �r�e�s�u�l�t� �a�s� �a� �s�t�r�i�n�g�:� �"�+�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�D�e�s�c�r�i�p�t�i�o�n�(�)�,�
�
� � � � � � � � � �"�T�r�a�d�e� �e�x�e�c�u�t�i�o�n� �m�o�d�e�:� �"�+�s�y�m�b�o�l�.�T�r�a�d�e�E�x�e�c�u�t�i�o�n�D�e�s�c�r�i�p�t�i�o�n�(�)�)�;�
�
� � � �P�r�i�n�t�(�"�D�e�a�l� �t�i�c�k�e�t�:� �"�+�I�n�t�e�g�e�r�T�o�S�t�r�i�n�g�(�t�r�a�d�e�.�R�e�s�u�l�t�D�e�a�l�(�)�)�+�"�,� �"�+�
�
� � � � � � � � � �"�O�r�d�e�r� �t�i�c�k�e�t�:� �"�+�I�n�t�e�g�e�r�T�o�S�t�r�i�n�g�(�t�r�a�d�e�.�R�e�s�u�l�t�O�r�d�e�r�(�)�)�+�"�,� �"�+�
�
� � � � � � � � � �"�O�r�d�e�r� �r�e�t�c�o�d�e� �e�x�t�e�r�n�a�l�:� �"�+�I�n�t�e�g�e�r�T�o�S�t�r�i�n�g�(�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�E�x�t�e�r�n�a�l�(�)�)�+�"�,� �"�+�
�
� � � � � � � � � �"�V�o�l�u�m�e� �o�f� �d�e�a�l� �o�r� �o�r�d�e�r�:� �"�+�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�t�r�a�d�e�.�R�e�s�u�l�t�V�o�l�u�m�e�(�)�,�2�)�)�;�
�
� � � �P�r�i�n�t�(�"�P�r�i�c�e�,� �c�o�n�f�i�r�m�e�d� �b�y� �b�r�o�k�e�r�:� �"�+�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�t�r�a�d�e�.�R�e�s�u�l�t�P�r�i�c�e�(�)�,�s�y�m�b�o�l�.�D�i�g�i�t�s�(�)�)�+�"�,� �"�+�
�
� � � � � � � � � �"�C�u�r�r�e�n�t� �b�i�d� �p�r�i�c�e�:� �"�+�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�s�y�m�b�o�l�.�B�i�d�(�)�,�s�y�m�b�o�l�.�D�i�g�i�t�s�(�)�)�+�"� �(�t�h�e� �r�e�q�u�o�t�e�)�:� �"�+�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�t�r�a�d�e�.�R�e�s�u�l�t�B�i�d�(�)�,�s�y�m�b�o�l�.�D�i�g�i�t�s�(�)�)�+�"�,� �"�+�
�
� � � � � � � � � �"�C�u�r�r�e�n�t� �a�s�k� �p�r�i�c�e�:� �"�+�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�s�y�m�b�o�l�.�A�s�k�(�)�,�s�y�m�b�o�l�.�D�i�g�i�t�s�(�)�)�+�"� �(�t�h�e� �r�e�q�u�o�t�e�)�:� �"�+�D�o�u�b�l�e�T�o�S�t�r�i�n�g�(�t�r�a�d�e�.�R�e�s�u�l�t�A�s�k�(�)�,�s�y�m�b�o�l�.�D�i�g�i�t�s�(�)�)�)�;�
�
� � � �P�r�i�n�t�(�"�B�r�o�k�e�r� �c�o�m�m�e�n�t�:� �"�+�t�r�a�d�e�.�R�e�s�u�l�t�C�o�m�m�e�n�t�(�)�)�;�
�
� � �}�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �G�e�t� �v�a�l�u�e� �o�f� �b�u�f�f�e�r�s� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�b�o�o�l� �i�G�e�t�A�r�r�a�y�(�c�o�n�s�t� �i�n�t� �h�a�n�d�l�e�,�c�o�n�s�t� �i�n�t� �b�u�f�f�e�r�,�c�o�n�s�t� �i�n�t� �s�t�a�r�t�_�p�o�s�,�
�
� � � � � � � � � � � � � � � �c�o�n�s�t� �i�n�t� �c�o�u�n�t�,�d�o�u�b�l�e� �&�a�r�r�_�b�u�f�f�e�r�[�]�)�
�
� � �{�
�
� � � �b�o�o�l� �r�e�s�u�l�t�=�t�r�u�e�;�
�
� � � �i�f�(�!�A�r�r�a�y�I�s�D�y�n�a�m�i�c�(�a�r�r�_�b�u�f�f�e�r�)�)�
�
� � � � � �{�
�
� � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � �P�r�i�n�t�F�o�r�m�a�t�(�"�E�R�R�O�R�!� �E�A�:� �%�s�,� �F�U�N�C�T�I�O�N�:� �%�s�,� �t�h�i�s� �a� �n�o� �d�y�n�a�m�i�c� �a�r�r�a�y�!�"�,�_�_�F�I�L�E�_�_�,�_�_�F�U�N�C�T�I�O�N�_�_�)�;�
�
� � � � � � �r�e�t�u�r�n�(�f�a�l�s�e�)�;�
�
� � � � � �}�
�
� � � �A�r�r�a�y�F�r�e�e�(�a�r�r�_�b�u�f�f�e�r�)�;�
�
�/�/�-�-�-� �r�e�s�e�t� �e�r�r�o�r� �c�o�d�e�
�
� � � �R�e�s�e�t�L�a�s�t�E�r�r�o�r�(�)�;�
�
�/�/�-�-�-� �f�i�l�l� �a� �p�a�r�t� �o�f� �t�h�e� �i�B�a�n�d�s� �a�r�r�a�y� �w�i�t�h� �v�a�l�u�e�s� �f�r�o�m� �t�h�e� �i�n�d�i�c�a�t�o�r� �b�u�f�f�e�r�
�
� � � �i�n�t� �c�o�p�i�e�d�=�C�o�p�y�B�u�f�f�e�r�(�h�a�n�d�l�e�,�b�u�f�f�e�r�,�s�t�a�r�t�_�p�o�s�,�c�o�u�n�t�,�a�r�r�_�b�u�f�f�e�r�)�;�
�
� � � �i�f�(�c�o�p�i�e�d�!�=�c�o�u�n�t�)�
�
� � � � � �{�
�
� � � � � � �/�/�-�-�-� �i�f� �t�h�e� �c�o�p�y�i�n�g� �f�a�i�l�s�,� �t�e�l�l� �t�h�e� �e�r�r�o�r� �c�o�d�e�
�
� � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � �P�r�i�n�t�F�o�r�m�a�t�(�"�E�R�R�O�R�!� �E�A�:� �%�s�,� �F�U�N�C�T�I�O�N�:� �%�s�,� �a�m�o�u�n�t� �t�o� �c�o�p�y�:� �%�d�,� �c�o�p�i�e�d�:� �%�d�,� �e�r�r�o�r� �c�o�d�e� �%�d�"�,�
�
� � � � � � � � � � � � � � � � � � � � � �_�_�F�I�L�E�_�_�,�_�_�F�U�N�C�T�I�O�N�_�_�,�c�o�u�n�t�,�c�o�p�i�e�d�,�G�e�t�L�a�s�t�E�r�r�o�r�(�)�)�;�
�
� � � � � � �/�/�-�-�-� �q�u�i�t� �w�i�t�h� �z�e�r�o� �r�e�s�u�l�t� �-� �i�t� �m�e�a�n�s� �t�h�a�t� �t�h�e� �i�n�d�i�c�a�t�o�r� �i�s� �c�o�n�s�i�d�e�r�e�d� �a�s� �n�o�t� �c�a�l�c�u�l�a�t�e�d�
�
� � � � � � �r�e�t�u�r�n�(�f�a�l�s�e�)�;�
�
� � � � � �}�
�
� � � �r�e�t�u�r�n�(�r�e�s�u�l�t�)�;�
�
� � �}�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �C�l�o�s�e� �p�o�s�i�t�i�o�n�s� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�v�o�i�d� �C�l�o�s�e�P�o�s�i�t�i�o�n�s�(�c�o�n�s�t� �E�N�U�M�_�P�O�S�I�T�I�O�N�_�T�Y�P�E� �p�o�s�_�t�y�p�e�)�
�
� � �{�
�
� � � �i�f�(�!�R�e�f�r�e�s�h�R�a�t�e�s�(�)�)�
�
� � � � � � �r�e�t�u�r�n�;�
�
� � � �f�o�r�(�i�n�t� �i�=�P�o�s�i�t�i�o�n�s�T�o�t�a�l�(�)�-�1�;� �i�>�=�0�;� �i�-�-�)� �/�/� �r�e�t�u�r�n�s� �t�h�e� �n�u�m�b�e�r� �o�f� �c�u�r�r�e�n�t� �p�o�s�i�t�i�o�n�s�
�
� � � � � � �i�f�(�m�_�p�o�s�i�t�i�o�n�.�S�e�l�e�c�t�B�y�I�n�d�e�x�(�i�)�)� �/�/� �s�e�l�e�c�t�s� �t�h�e� �p�o�s�i�t�i�o�n� �b�y� �i�n�d�e�x� �f�o�r� �f�u�r�t�h�e�r� �a�c�c�e�s�s� �t�o� �i�t�s� �p�r�o�p�e�r�t�i�e�s�
�
� � � � � � � � � �i�f�(�m�_�p�o�s�i�t�i�o�n�.�S�y�m�b�o�l�(�)�=�=�m�_�s�y�m�b�o�l�.�N�a�m�e�(�)� �&�&� �m�_�p�o�s�i�t�i�o�n�.�M�a�g�i�c�(�)�=�=�I�n�p�M�a�g�i�c�)�
�
� � � � � � � � � � � � �i�f�(�m�_�p�o�s�i�t�i�o�n�.�P�o�s�i�t�i�o�n�T�y�p�e�(�)�=�=�p�o�s�_�t�y�p�e�)�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �i�f�(�m�_�p�o�s�i�t�i�o�n�.�P�o�s�i�t�i�o�n�T�y�p�e�(�)�=�=�P�O�S�I�T�I�O�N�_�T�Y�P�E�_�B�U�Y�)�
�
� � � � � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � � � � �i�f�(�!�m�_�t�r�a�d�e�.�P�o�s�i�t�i�o�n�C�l�o�s�e�(�m�_�p�o�s�i�t�i�o�n�.�T�i�c�k�e�t�(�)�)�)� �/�/� �c�l�o�s�e� �a� �p�o�s�i�t�i�o�n� �b�y� �t�h�e� �s�p�e�c�i�f�i�e�d� �m�_�s�y�m�b�o�l�
�
� � � � � � � � � � � � � � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � � � � � � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�"�B�U�Y� �P�o�s�i�t�i�o�n�C�l�o�s�e� �"�,�m�_�p�o�s�i�t�i�o�n�.�T�i�c�k�e�t�(�)�,�"�,� �"�,�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�D�e�s�c�r�i�p�t�i�o�n�(�)�)�;�
�
� � � � � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � � � � �i�f�(�m�_�p�o�s�i�t�i�o�n�.�P�o�s�i�t�i�o�n�T�y�p�e�(�)�=�=�P�O�S�I�T�I�O�N�_�T�Y�P�E�_�S�E�L�L�)�
�
� � � � � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � � � � �i�f�(�!�m�_�t�r�a�d�e�.�P�o�s�i�t�i�o�n�C�l�o�s�e�(�m�_�p�o�s�i�t�i�o�n�.�T�i�c�k�e�t�(�)�)�)� �/�/� �c�l�o�s�e� �a� �p�o�s�i�t�i�o�n� �b�y� �t�h�e� �s�p�e�c�i�f�i�e�d� �m�_�s�y�m�b�o�l�
�
� � � � � � � � � � � � � � � � � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � � � � � � � � � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �E�R�R�O�R�:� �"�,�"�S�E�L�L� �P�o�s�i�t�i�o�n�C�l�o�s�e� �"�,�m�_�p�o�s�i�t�i�o�n�.�T�i�c�k�e�t�(�)�,�"�,� �"�,�m�_�t�r�a�d�e�.�R�e�s�u�l�t�R�e�t�c�o�d�e�D�e�s�c�r�i�p�t�i�o�n�(�)�)�;�
�
� � � � � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � � � �}�
�
� � �}�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �C�a�l�c�u�l�a�t�e� �a�l�l� �p�o�s�i�t�i�o�n�s� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�|� � �'�l�o�t�s�_�l�i�m�i�t�=�t�r�u�e�'� �-� �o�n�l�y� �f�o�r� �'�i�f�(�m�_�s�y�m�b�o�l�.�L�o�t�s�L�i�m�i�t�(�)�>�0�.�0�)�'� � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�v�o�i�d� �C�a�l�c�u�l�a�t�e�A�l�l�P�o�s�i�t�i�o�n�s�(�i�n�t� �&�c�o�u�n�t�_�b�u�y�s�,�d�o�u�b�l�e� �&�v�o�l�u�m�e�_�b�u�y�s�,�d�o�u�b�l�e� �&�v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�b�u�y�s�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � �i�n�t� �&�c�o�u�n�t�_�s�e�l�l�s�,�d�o�u�b�l�e� �&�v�o�l�u�m�e�_�s�e�l�l�s�,�d�o�u�b�l�e� �&�v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�s�e�l�l�s�,�
�
� � � � � � � � � � � � � � � � � � � � � � � � � � � �b�o�o�l� �l�o�t�s�_�l�i�m�i�t�=�f�a�l�s�e�)�
�
� � �{�
�
� � � �c�o�u�n�t�_�b�u�y�s� � � � � � � � � � � �=� �0�;�
�
� � � �v�o�l�u�m�e�_�b�u�y�s� � � � � � � � � � �=� �0�.�0�;�
�
� � � �v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�b�u�y�s� � �=� �0�.�0�;�
�
� � � �c�o�u�n�t�_�s�e�l�l�s� � � � � � � � � � �=� �0�;�
�
� � � �v�o�l�u�m�e�_�s�e�l�l�s� � � � � � � � � �=� �0�.�0�;�
�
� � � �v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�s�e�l�l�s� �=� �0�.�0�;�
�
� � � �f�o�r�(�i�n�t� �i�=�P�o�s�i�t�i�o�n�s�T�o�t�a�l�(�)�-�1�;� �i�>�=�0�;� �i�-�-�)�
�
� � � � � � �i�f�(�m�_�p�o�s�i�t�i�o�n�.�S�e�l�e�c�t�B�y�I�n�d�e�x�(�i�)�)� �/�/� �s�e�l�e�c�t�s� �t�h�e� �p�o�s�i�t�i�o�n� �b�y� �i�n�d�e�x� �f�o�r� �f�u�r�t�h�e�r� �a�c�c�e�s�s� �t�o� �i�t�s� �p�r�o�p�e�r�t�i�e�s�
�
� � � � � � � � � �i�f�(�m�_�p�o�s�i�t�i�o�n�.�S�y�m�b�o�l�(�)�=�=�m�_�s�y�m�b�o�l�.�N�a�m�e�(�)� �&�&� �(�l�o�t�s�_�l�i�m�i�t� �|�|� �(�!�l�o�t�s�_�l�i�m�i�t� �&�&� �m�_�p�o�s�i�t�i�o�n�.�M�a�g�i�c�(�)�=�=�I�n�p�M�a�g�i�c�)�)�)�
�
� � � � � � � � � � � �{�
�
� � � � � � � � � � � � �i�f�(�m�_�p�o�s�i�t�i�o�n�.�P�o�s�i�t�i�o�n�T�y�p�e�(�)�=�=�P�O�S�I�T�I�O�N�_�T�Y�P�E�_�B�U�Y�)�
�
� � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � �c�o�u�n�t�_�b�u�y�s�+�+�;�
�
� � � � � � � � � � � � � � � �v�o�l�u�m�e�_�b�u�y�s�+�=�m�_�p�o�s�i�t�i�o�n�.�V�o�l�u�m�e�(�)�;�
�
� � � � � � � � � � � � � � � �i�f�(�m�_�p�o�s�i�t�i�o�n�.�V�o�l�u�m�e�(�)�>�v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�b�u�y�s�)�
�
� � � � � � � � � � � � � � � � � � �v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�b�u�y�s�=�m�_�p�o�s�i�t�i�o�n�.�V�o�l�u�m�e�(�)�;�
�
� � � � � � � � � � � � � � � �c�o�n�t�i�n�u�e�;�
�
� � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � � �e�l�s�e�
�
� � � � � � � � � � � � � � � �i�f�(�m�_�p�o�s�i�t�i�o�n�.�P�o�s�i�t�i�o�n�T�y�p�e�(�)�=�=�P�O�S�I�T�I�O�N�_�T�Y�P�E�_�S�E�L�L�)�
�
� � � � � � � � � � � � � � � � � �{�
�
� � � � � � � � � � � � � � � � � � �c�o�u�n�t�_�s�e�l�l�s�+�+�;�
�
� � � � � � � � � � � � � � � � � � �v�o�l�u�m�e�_�s�e�l�l�s�+�=�m�_�p�o�s�i�t�i�o�n�.�V�o�l�u�m�e�(�)�;�
�
� � � � � � � � � � � � � � � � � � �i�f�(�m�_�p�o�s�i�t�i�o�n�.�V�o�l�u�m�e�(�)�>�v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�s�e�l�l�s�)�
�
� � � � � � � � � � � � � � � � � � � � � �v�o�l�u�m�e�_�b�i�g�g�e�s�t�_�s�e�l�l�s�=�m�_�p�o�s�i�t�i�o�n�.�V�o�l�u�m�e�(�)�;�
�
� � � � � � � � � � � � � � � � � �}�
�
� � � � � � � � � � � �}�
�
� � �}�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�/�/�|� �S�e�a�r�c�h� �t�r�a�d�i�n�g� �s�i�g�n�a�l�s� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �|�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�b�o�o�l� �S�e�a�r�c�h�T�r�a�d�i�n�g�S�i�g�n�a�l�s�(�v�o�i�d�)�
�
� � �{�
�
� � � �d�o�u�b�l�e� �f�a�s�t�[�]�,�s�l�o�w�[�]�;�
�
� � � �A�r�r�a�y�S�e�t�A�s�S�e�r�i�e�s�(�f�a�s�t�,�t�r�u�e�)�;�
�
� � � �A�r�r�a�y�S�e�t�A�s�S�e�r�i�e�s�(�s�l�o�w�,�t�r�u�e�)�;�
�
� � � �i�n�t� �s�t�a�r�t�_�p�o�s�=�0�,�c�o�u�n�t�=�6�;�
�
� � � �i�f�(�!�i�G�e�t�A�r�r�a�y�(�h�a�n�d�l�e�_�i�C�u�s�t�o�m�_�F�a�s�t�,�0�,�s�t�a�r�t�_�p�o�s�,�c�o�u�n�t�,�f�a�s�t�)� �|�|� �!�i�G�e�t�A�r�r�a�y�(�h�a�n�d�l�e�_�i�C�u�s�t�o�m�_�S�l�o�w�,�0�,�s�t�a�r�t�_�p�o�s�,�c�o�u�n�t�,�s�l�o�w�)�)�
�
� � � � � � �r�e�t�u�r�n�(�f�a�l�s�e�)�;�
�
� � � �i�n�t� �s�i�z�e�_�n�e�e�d�_�p�o�s�i�t�i�o�n�=�A�r�r�a�y�S�i�z�e�(�S�P�o�s�i�t�i�o�n�)�;�
�
� � � �i�f�(�s�i�z�e�_�n�e�e�d�_�p�o�s�i�t�i�o�n�>�0�)�
�
� � � � � � �r�e�t�u�r�n�(�t�r�u�e�)�;�
�
�/�/�-�-�-� �B�U�Y� �S�i�g�n�a�l�
�
� � � �i�f�(�f�a�s�t�[�1�]�<�s�l�o�w�[�1�]� �&�&� �f�a�s�t�[�0�]�>�s�l�o�w�[�0�]�)�
�
� � � � � �{�
�
� � � � � � �/�/�-�-�-�
�
� � � � � � �E�N�U�M�_�S�Y�M�B�O�L�_�T�R�A�D�E�_�M�O�D�E� �t�r�a�d�e�_�m�o�d�e�=�m�_�s�y�m�b�o�l�.�T�r�a�d�e�M�o�d�e�(�)�;�
�
� � � � � � �i�f�(�t�r�a�d�e�_�m�o�d�e�=�=�S�Y�M�B�O�L�_�T�R�A�D�E�_�M�O�D�E�_�D�I�S�A�B�L�E�D�)�
�
� � � � � � � � � �r�e�t�u�r�n�(�t�r�u�e�)�;�
�
� � � � � � �/�/�-�-�-�
�
� � � � � � �i�f�(�t�r�a�d�e�_�m�o�d�e�!�=�S�Y�M�B�O�L�_�T�R�A�D�E�_�M�O�D�E�_�F�U�L�L�)�
�
� � � � � � � � � �i�f�(�t�r�a�d�e�_�m�o�d�e�=�=�S�Y�M�B�O�L�_�T�R�A�D�E�_�M�O�D�E�_�S�H�O�R�T�O�N�L�Y� �|�|� �t�r�a�d�e�_�m�o�d�e�=�=�S�Y�M�B�O�L�_�T�R�A�D�E�_�M�O�D�E�_�C�L�O�S�E�O�N�L�Y�)�
�
� � � � � � � � � � � � �r�e�t�u�r�n�(�t�r�u�e�)�;�
�
� � � � � � �A�r�r�a�y�R�e�s�i�z�e�(�S�P�o�s�i�t�i�o�n�,�s�i�z�e�_�n�e�e�d�_�p�o�s�i�t�i�o�n�+�1�)�;�
�
� � � � � � �S�P�o�s�i�t�i�o�n�[�s�i�z�e�_�n�e�e�d�_�p�o�s�i�t�i�o�n�]�.�p�o�s�_�t�y�p�e�=�P�O�S�I�T�I�O�N�_�T�Y�P�E�_�B�U�Y�;�
�
� � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �O�K�:� �"�,�"�S�i�g�n�a�l� �B�U�Y�"�)�;�
�
� � � � � � �r�e�t�u�r�n�(�t�r�u�e�)�;�
�
� � � � � �}�
�
�/�/�-�-�-� �S�E�L�L� �S�i�g�n�a�l�
�
� � � �i�f�(�f�a�s�t�[�1�]�>�s�l�o�w�[�1�]� �&�&� �f�a�s�t�[�0�]�<�s�l�o�w�[�0�]�)�
�
� � � � � �{�
�
� � � � � � �/�/�-�-�-�
�
� � � � � � �E�N�U�M�_�S�Y�M�B�O�L�_�T�R�A�D�E�_�M�O�D�E� �t�r�a�d�e�_�m�o�d�e�=�m�_�s�y�m�b�o�l�.�T�r�a�d�e�M�o�d�e�(�)�;�
�
� � � � � � �i�f�(�t�r�a�d�e�_�m�o�d�e�=�=�S�Y�M�B�O�L�_�T�R�A�D�E�_�M�O�D�E�_�D�I�S�A�B�L�E�D�)�
�
� � � � � � � � � �r�e�t�u�r�n�(�t�r�u�e�)�;�
�
� � � � � � �/�/�-�-�-�
�
� � � � � � �i�f�(�t�r�a�d�e�_�m�o�d�e�!�=�S�Y�M�B�O�L�_�T�R�A�D�E�_�M�O�D�E�_�F�U�L�L�)�
�
� � � � � � � � � �i�f�(�t�r�a�d�e�_�m�o�d�e�=�=�S�Y�M�B�O�L�_�T�R�A�D�E�_�M�O�D�E�_�L�O�N�G�O�N�L�Y� �|�|� �t�r�a�d�e�_�m�o�d�e�=�=�S�Y�M�B�O�L�_�T�R�A�D�E�_�M�O�D�E�_�C�L�O�S�E�O�N�L�Y�)�
�
� � � � � � � � � � � � �r�e�t�u�r�n�(�t�r�u�e�)�;�
�
� � � � � � �A�r�r�a�y�R�e�s�i�z�e�(�S�P�o�s�i�t�i�o�n�,�s�i�z�e�_�n�e�e�d�_�p�o�s�i�t�i�o�n�+�1�)�;�
�
� � � � � � �S�P�o�s�i�t�i�o�n�[�s�i�z�e�_�n�e�e�d�_�p�o�s�i�t�i�o�n�]�.�p�o�s�_�t�y�p�e�=�P�O�S�I�T�I�O�N�_�T�Y�P�E�_�S�E�L�L�;�
�
� � � � � � �i�f�(�I�n�p�P�r�i�n�t�L�o�g�)�
�
� � � � � � � � � �P�r�i�n�t�(�_�_�F�I�L�E�_�_�,�"� �"�,�_�_�F�U�N�C�T�I�O�N�_�_�,�"�,� �O�K�:� �"�,�"�S�i�g�n�a�l� �S�E�L�L�"�)�;�
�
� � � � � � �r�e�t�u�r�n�(�t�r�u�e�)�;�
�
� � � � � �}�
�
�/�/�-�-�-�
�
� � � �r�e�t�u�r�n�(�t�r�u�e�)�;�
�
� � �}�
�
�/�/�+�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�-�+�
�
�

Comments