Диалог установки стопа и лимита

Set Stop/Limit dialog has next controls:

Ticket

This is a combo box that allows selecting one of ticket from the table of Open position window. In initial state it is the ticket from selected row in the table. If there is no selected row, it is a ticket of first row. There're tickets of all positions in popup list. If there're positions with accounts under margin call or with not tradable currency, their tickets are shown with Gray foreground color. If such ticket is selected, text of combo box is shown with Gray foreground color too. Also buttons Set and Remove becomes disabled. When ticket of position with account not under margin call is selected, which one's currency is tradable, text of combo box is shown with Black foreground color. Also buttons Set and Remove become enabled if others controls permit that and the dialog is not disabled consider application state.

Stop/Limit

This is a combo box that allows selecting one of two types of edit values in Open Position: Stop or Limit.

Stop value forces Position to be closed if its close price fall down to Stop value if position has been opened as BUY position, or if price grow up to Stop value if position has been opened as SELL position. Limit value forces Position to be closed if its close price grow up to Stop value if position has been opened as BUY position, or if price fall down to Stop value if position has been opened as SELL position.

Rate

This is spin box that allows entering the Stop or Limit values. User can do it manually or using spins buttons. Initially value is initially filled with:

- Closed price + one pip for Stop value for SELL position
- Closed price - one pip for Stop value for BUY position
- Closed price + one pip for Limit value for BUY position
- Closed price - one pip for Limit value for SELL position

The value that equals current price or negative is not permitted, therefore if value reaches 0 by using down spin button, it initiates to listed values below again.

There is not editable text field right next to Rate controls, that shows condition, which restrict input value. Initially it is filled by the same value as and Rate field. But this value is changed when close price of selected position is changed or ticket is changed or Stop/Limit type is changed.

There're two buttons:

Set

and Remove

Are disabled in next cases:

1. In reconnection state.
2. If selected position has account under margin call
3. If selected position has currency that is not tradable

When button Set is pressed the Set Stop or Set Limit Order is created and transmitted to server. When button Remove is pressed the Reset Stop or Reset Limit Order is created and transmitted to server. But dialog has closed immediately after button is clicked.

As soon as server has admitted order, the entered value appears in Stop or Limit column of corresponded row in table of Open Position in case of pressing button Set. In case of pressing button Remove 0 appears in Stop or Limit column of corresponded row in table of Open Position.

Cancel

Just hides Set Stop/Limit dialog.