Skip to main content

📊 Margin Square Off Template

Functionality Description: Add Group – New Window Behavior

When the user clicks the “Add Group” button, a new pop-up window will be displayed.
This window allows the user to define the type of group they want to create.

Pop-Up Window Details

The pop-up window contains the following elements:

Radio Buttons (Selection Options)

  • MTM Square-off (Default selection)
  • Margin Square-off

Action Buttons

  • Add – Confirms the selected option and proceeds with group creation.
  • Cancel – Closes the window without making any changes.

Default Behavior
The “MTM Square-off” option will be selected by default when the pop-up window appears.

UI Validations

1. Selection Behavior (Radio Buttons)

  • Only one option can be selected at a time.
  • If the user selects “Margin Square-off”, the “MTM Square-off” option will automatically be unselected.
  • If the user selects “MTM Square-off”, the “Margin Square-off” option will automatically be unselected.

This ensures that only one trigger type is chosen for each group.

2. Validation for Duplicate Segment + Product Combination

The system validates combinations of Segment + Product across different groups, based on the selected trigger type.

A toaster message will appear only when the same Segment + Product combination is used in multiple groups with the same trigger type.

Scenario 1: Different Trigger Types → Allowed

Group 1: MTM Square-off
Group 2: Margin Square-off
Segment + Product: Same in both groups
→ System will allow saving the template (No error)

Scenario 2: Same Trigger Type → Not Allowed

Group 1: MTM Square-off
Group 2: MTM Square-off
Segment + Product: Same in both groups
→ System will restrict saving and display the toaster message:

“Same Combination of Segment + Product is available in Multiple Group.”

Template Mapping

User can Map the respective Margin/MTM Square off Template through Entity wise/Entity Profile wise/Entity Type wise in Template Mapping.

Widget Name

Margin Square-off Widget NameApplicable Fields
"Position to consider & Square-off""Market Segment" - List of Market Segments i.e., ALL EQ, ALL FNO, ALL CURR, MCX, NCDEX, NSE COMM
"Product" - List of Products as per the Market Segment selected
"Margin Limit"
("MTM Limit" widget shall be renamed as "Margin Limit")
• The list of editable and non-editable deposits shall be displayed with the multiplier, as per existing workflow.
"Margin MTM Utilization"
("MTM Utilization" shall be renamed as "Margin MTM Utilization")
• Net MTM Loss
• Booked Profit
• Booked Loss
• Booked Profit - Option
• Booked Loss - Option
• Brokerage and Charges
• Option CFS limit
• Net Premium Payable

SquareOff Rules

Field NameField TypeRange / ValueDefault Value
Pre Margin Square off PercentagePERCENTAGE0 to 999.99990
Post Margin Square off PercentagePERCENTAGE0 to 999.99990
Revert Pre Margin Trigger Restriction PercentagePERCENTAGE0 to 999.99990
Pre Trigger EventDropdown• Restrict Fresh Order
• Restrict Position Conversion
Restrict Fresh Order
Post Trigger EventDropdown• Restrict Fresh Order
• Restrict Fresh + Cancel Pending Order
• Restrict Fresh + Cancel Pending Order + Square-off Open Position
• Restrict Position Conversion
Restrict Fresh Order
Margin trigger TimeTime09:30:00

Margin Square-off Calculation Logic

Trigger Logic

The margin square-off triggers based on the configured Pre and Post threshold percentages.
When triggered, the system will:

  • Restrict fresh orders / position conversion
  • Cancel pending orders (based on selected rule)
  • Square-off open positions (based on selected rule)

All actions are governed by the selections made in Position to Consider & Square-off.

Margin Utilization Calculation

Margin Utilization = Computed based on:

Margin Limit
→ Derived from the value configured in Margin Limit widget.

Margin Considered
Includes all types of margin:

  • Exposure , SPAN , Physical Delivery Margin , Scrip Basket Margin , Holding Selling Margin , Buyback Margin , etc.

Items Included from Widget

  • Booked Profit, Booked Loss, Booked Profit - Option, Booked Loss - Option, Brokerage and Charges and Option CFS limit shall be considered from the Margin utilization widget.

Items Excluded

  • The brokerage toggle from the RRT template shall not be consider to calculate the margin utilization.
  • The OI template from the RRT template shall not be consider to calculate the margin utilization.

Premium Handling

  • If FNO segment is selected and premium payable exists → considered as part of margin utilization.
  • If Net Premium Payable toggle is ON: Premium receivable will only be adjusted against premium payable of the same segment (not against margin)

Timing Rules

Margin trigger event will only execute if:
Current Time ≥ Configured “Margin Trigger Time”

Position Consideration Policy

The system considers:

  • Uploaded positions
  • Daily traded positions

Pending orders are not considered (aligned with exchange peak margin policy).

Margin for uploaded positions is calculated as per existing Master Config logic.

Square-off Order Placement

  • Orders are placed through ALGO & Default Dealer
  • Configuration source:
    Config UI → rms-adaptor → SQOFF_ALGO
  • Square-off price derivation:
    Master Config → General Tab → Square Off Price Method

T2T Scrip Handling

If a square-off order is generated for a T2T scrip:

  • The order will be rejected

Scenarios That Can Trigger Margin Square‑off (Due to Increase in Margin Utilization)

The Margin Square‑off mechanism can be triggered when margin utilization increases and breaches the configured Pre/Post thresholds. Below are scenarios that may cause such an increase:

  1. Intraday SPAN File Upload

    • Updated exchange risk files (SPAN/Exposure) increase margin requirements for existing positions.
  2. Hedge/Spread Break Scenario

    • A hedge/spread relationship breaks (e.g., one leg squared‑off or expires), removing the benefit and increasing margin.
  3. Change in RRT / Master Configuration

    • Changes to risk parameters or calculation logic (e.g., utilization inclusions/exclusions) raise the required margin or lower available limits.
  4. Physical Delivery Margin Application

    • Positions moving into delivery (e.g., equity/F&O nearing expiry) attract additional physical delivery margins.
  5. Calendar Spread Benefit Adjustment

    • Reduction/removal of calendar spread benefit (due to time/eligibility changes) increases margin.
  6. Pending Order Traded → Position Becomes Delivery

    • Pending orders get executed and result in positions moving into physical delivery, increasing margin requirements.
  7. Position Upload

    • Uploaded positions (intraday or start‑of‑day load) increase the exposure and thereby utilization.
  8. Change in Mapped Template

    • Switching to a different risk template (RRT/config mapping) alters applicable rules/limits and increases utilization.
  9. Position Conversion

    • Converting positions (e.g., MIS → NRML / Intraday → Carry Forward) increases margin requirement.

Trigger Rule (Applies to All Scenarios)

If Margin Utilization exceeds the configured Pre or Post threshold and the current time is on/after the Margin Trigger Time, the corresponding actions shall execute based on Square-off Rules:

  • Pre Trigger Event

    • Restrict Fresh Order
    • Restrict Position Conversion
  • Post Trigger Event

    • Restrict Fresh orders
    • Cancel Pending Orders
    • Square-off Open Positions

Alert Message

  • Alert message shall be displayed in the right-side collapse panel
  • Example:1
    • System should display the following alert message in Side Panel as follows:
      • Time: 14:25 Pre Margin Triggered. Set Limit:1000, Utilization: 750 for Entity ID: CLI1 Template Name: MARGIN_Delivery
      • Time: 14:25 Post Margin Triggered. Set Limit:1000, Utilization: 850 for Entity ID: CLI1 Template Name: MARGIN_Delivery
    • Event History
Alert TimeEvent TypeEntity IdTrigger TypeTemplate NameMTM/Margin Set LimitMTM/Margin Utilization
14:25MarginCLI1Pre Margin TriggeredMARGIN_Delivery1000750
14:30MarginCLI1Post Margin TriggeredMARGIN_Delivery1000850
  • Example:2
    • Rejection: Restrict Fresh Order Based on Margin
      • MARGIN_TRIGGER_TYPE = PRE Margin Trigger/Post Margin Trigger
      • MARGIN_SETLIMIT = 10000
      • MARGIN_TRIGGER_VALUE = 5000
      • MARGIN_TRIGGER_PER = 50%
      • MARGIN_UTILIZATION = 5000
      • TEMPMAP_VALID_ENTY_ID = RET1
      • TEMPMAP_TEMPLATE_TYPE = MTM TEMPLATE
      • TEMPMAP_TEMPLATE_NAME = MTM_TEMP1
      • PRE Margin trigger Rejection: Fresh Order Restricted due to Pre Margin Trigger Set Limit: 10000, Trigger Value:5000, Trigger%: 50%, Utilization: 5000 for RET1 in MTMT - MTM_TEMP1.

Note:

  • In "Margin MTM Utilization" in Margin Square off Template"
    • Net Premium Payable
      • If the Net Premium Payable toggle is ON in Margin utilization widget, then system shall adjust the receivable with the payable of same segment and consider the net payable in the utilization.
      • If the Net Premium Payable toggle is OFF, then system shall not adjust the receivable with the payable of same segment.
    • Net MTM Loss:
      • If "Net MTM Loss" toggle is enabled, then the system shall consider the Unrealized Net MTM Loss as a utilization.
      • Net MTM Loss shall be calculated and considered for all the segments added in the "Position to consider & Square-off"
  • Example 3:
    • Case:1
      • Position to consider & Square-off = Segment: ALL EQ Product: Margin
      • Margin Limit = Cash: 30000 & Adhoc: 2000
      • Margin MTM Utilization = Booked Profit: Tick, Booked Loss: Tick, Booked Profit - Option: Tick, Booked Loss - Option: Tick, Brokerage and Charges - Order Based, Option CFS limit - Tick
      • Pre Margin Square off Percentage = 90% and Margin Square off Percentage = 95%
      • Revert Margin Trigger Restriction Percentage - 10%
      • Pre Trigger Event - Restrict Fresh Order & Restrict Position Conversion
      • Post Trigger Event - Restrict Fresh + Cancel Pending + Square-off open position & Restrict Position Conversion
      • Margin trigger Timer - 09:30
      • Consider Buy margin set as 20% in the RRT.
Action/EventDetailsRemarks/System Response
Order1: Trade Buy- Consider current time is 11:00
- NSEEQ-ACC-Margin-Qty: 100, Price: 1200
- Total Margin Utilized: 24,000
No Trigger, because Margin utilized = 75% only.
Order2: Trade Buy- NSEEQ-TCS-Margin-Qty: 13, Price: 2000
- Current order Margin: 5200
- New Margin utilized: 29200 (24000 + 5200)
- Margin Utilized% = 91.25%, so Pre Margin Triggered
Restrict Fresh Order & Restrict Position Conversion shall be activated as per the Pre Trigger Event.
Order3: Buy Order- NSEEQ-TCS-Margin-Qty: 13, Price: 2000- The order shall be rejected and shall display the following error.
Fresh Order Restricted due to Pre Margin Trigger. Set Limit:32000, Trigger Value:28800, Trigger %:90, Utilization: 29200 for RET1 in MTMT - MTMTemp1
Client square off the TCS position at same price- The client square off the position in TCS- Margin Utilized = 24000, so system shall revert the Pre Margin square-off trigger.
- Set Limit: 32000 and 10% of that is 3200.
- Revert Margin Trigger value is 25600 = 28800-3200
Now the Margin utilized reduced to 24000 it is less than Revert Margin Trigger value so the revert trigger shall trigger.
Order4: Pending Buy- NSEEQ-TCS-Margin-Qty: 16, Price: 2000
- Current Order Margin: 6400
- New Margin Utilized: 30,400
Here since its pending order system will not post trigger even if set % limit of 95% is breached.
Order 5: Pending Buy order gets traded- NSEEQ-TCS-Margin-Qty: 16, Price: 2000
- Current Trade Margin: 6400
- New Margin Utilized: 30,400
- Margin Utilized% = 95%, so Post Triggered.
- Restrict Fresh + Cancel Pending + Square-off open position & Restrict Position Conversion shall be activated as per the Post Trigger Event.
   - NSEEQ-TCS-Margin - 16 qty must get square off
   - NSEEQ-ACC-Margin-Qty: 100 - Square-off order shall be placed. (Consider Square-off Traded with Booked Loss "1000"rs)
- After Square-off trade utilization shall be:
- Set Limit:32000, Post Trigger Value:30400, Trigger %95, Utilization: 1000
    • Case:2
      • Position to consider & Square-off = Segment: ALL FNO, Product: Carryforward
      • Margin Limit = Cash: 1,50,000
      • Margin MTM Utilization = Booked Profit: Tick, Booked Loss: Tick, Booked Profit - Option: Tick, Booked Loss - Option: Tick, Brokerage and Charges - Order Based, Option CFS limit - Tick
      • Pre Margin Square off Percentage = 80% and Margin Square off Percentage = 90%
      • Pre Trigger Event - Restrict Fresh Order & Restrict Position Conversion
      • Post Trigger Event - Restrict Fresh + Cancel Pending + Square-off open position & Restrict Position Conversion
      • Margin trigger Timer - 15:00
Action/EventDetailsRemarks/System Response
Upload: Option Buy Position
Upload price set as "zero price" in Master config
  • Consider current time is 11:00
  • NSEFNO-OPTSTK-ACC-2000-Carry forward-Qty: 300, Price: 0
  • Total Margin Utilized: 0
  • No Trigger.
Order1: Option Buy Trade
  • Consider current time is 11:10
  • NSEFNO-OPTSTK-ACC-2000-Carry forward-Qty: 300, Price: 490
  • Total Margin Utilized: 147000 (Premium payable)
  • System should consider the premium payable as a Margin utilization.
  • Set Limit:150000, Post Trigger Value:135000, Trigger %90, Utilization: 147000
  • The Margin Post-Trigger shall not be triggered because the current time is 11:00 and the trigger time is 15:00, if the current time is equal to or more than trigger time: 15:00, then Post trigger event shall be triggered.
Order2: Option Sell Trade (Square-off)
  • Consider current time is 14:00
  • NSEFNO-OPTSTK-ACC-2000-Carry forward-Qty: 300, Price: 30
  • Now the client placed a square-off order for the daily position.
  • Now the premium utilized is "0" and option booked Loss is 138000.
  • Set Limit:150000, Post Trigger Value:135000, Trigger %:90, Utilization: 138000
  • The Margin Post-Trigger shall not be triggered due to timer.
Time changed
  • Consider current time changed to 15:00
  • Post Triggered shall be triggered.
  • Restrict Fresh + Cancel Pending + Square-off open position & Restrict Position Conversion shall be activated as per the Post Trigger Event.
    • NSEFNO-OPTSTK-ACC-2000-Carry forward-Qty: 300 - Square-off order shall be placed for uploaded buy position.
  • If any further fresh order placed and if the recalculated Margin utilization is more than pre trigger and less than post trigger, then order shall be rejected due to pre trigger with the recalculated value.
  • If the recalculated value is more than the post trigger value, then system shall reject the order for post trigger with recalculated value.
  • If the recalculated value is less than the pre trigger value, then also system shall reject the order
    • Case:3
      • Position to consider & Square-off = Segment: ALL FNO, Product: Carryforward
      • Margin Limit = Cash: 2,00,000
      • Margin MTM Utilization = Booked Profit: Tick, Booked Loss: Tick, Booked Profit - Option: Tick, Booked Loss - Option: Tick, Brokerage and Charges - Order Based, Option CFS limit - UnTick, Net Premium Payable-Tick
      • Pre Margin Square off Percentage = 80% and Margin Square off Percentage = 85%
      • Pre Trigger Event - Restrict Fresh Order & Restrict Position Conversion
      • Post Trigger Event - Restrict Fresh + Cancel Pending + Square-off open position & Restrict Position Conversion
      • Consider "Restrict Square Off on Margin Increase & Shortfall" rule is un-selected in the RRT.
Action/EventDetailsRemarks/System Response
Order1: Hedge Order Through Multi leg order book
  • Leg1: SELL-NSEFNO-OPTSTK-INFY-1400-CE-24/04/2025-Carry forward-Qty: 400, Price: 55
  • Leg2: BUY-NSEFNO-FUTSTK-INFY-24/04/2025-Carry forward-Qty: 400, Price: 1388.20
  • Individual Margin
    • Leg1: Expo: 19732 Span: 174660 Total Margin: 194392 Premium receivable: 22000
    • Leg2: Expo: 19710 Span: 91811 Total Margin: 111521
  • Margin Utilization after Hedge benefit.
    • Expo: 39442 Span: 118844 Total Margin: 158286
  • No Trigger.
  • Set Limit:200000, Post Trigger Value:170000, Trigger %85, Utilization: 158286
  • Premium receivable shall not be adjusted with the Margin utilization.
    • Total margin utilization is 158286.
Order2: Future sell (Square-off Traded)
  • Leg2: SELL-NSEFNO-FUTSTK-INFY-24/04/2025-Carry forward-Qty: 400, Price: 1400
  • Post got triggered, Margin utilization increased due Hedge position break.
  • Margin utilization for option sell is 194392.
  • Set Limit:200000, Post Trigger Value:170000, Trigger %85, Utilization: 194392
  • In this case Traded square order is creating overall position margin to shoot up so system will trigger square off
  • Note : In this case if the square off order future order is in pending then margin square off will not got triggered (As exchange computing margin on trade basis we will keep it the same).
    • Case:4
      • Position to consider & Square-off = Segment: ALL FNO, Product: Carryforward, Segment: ALL EQ Product: Delivery
      • Margin Square-off Limit = Cash: 200000
      • Pre Margin Square off Percentage = 95% and Margin Square off Percentage = 100%
      • Margin MTM Utilization = Net Booked Loss: Tick, Booked Profit: Tick, Booked Loss: Tick, Booked Profit - Option: Tick, Booked Loss - Option: Tick, Brokerage and Charges - Order Based, Option CFS limit - Tick, Net MTM Loss- Tick
      • Pre Trigger Event - Restrict Fresh Order & Restrict Position Conversion
      • Post Trigger Event - Restrict Fresh + Cancel Pending + Square-off open position & Restrict Position Conversion
      • Pre Trigger: Set Limit: 200000, Pre Trigger Value: 190000, Trigger %: 95%
      • Post Trigger: Set Limit: 200000, Post Trigger Value: 200000, Trigger %: 100%
      • Consider Buy margin set as 100% in the RRT for Delivery product type.
Action/EventDetailsRemarks/System Response
Order 1 Traded: Future Buy
  • BUY-NSEFNO-FUTSTK-INFY-24/04/2025-Carry forward-Qty: 400, Price: 1390
  • Margin charged: Total Margin: 91,811
  • Consider current LTP is 1400, so the MTM is in profit so the system shall consider the Net MTM Loss as "0"
  • No Trigger.
  • Set Limit:200000, Pre Trigger Value:190000, Trigger %95, Utilization: 91811
Order 2 Traded: EQ Buy
  • NSEEQ-TCS-Delivery-Qty: 30, Price: 3000
  • Current order Margin: 90,000
  • New Margin utilized: 1,81,811 (91,811+ 90,000)
  • Consider current LTP is 3000, so there is no MTM Loss.
  • No Trigger.
  • Set Limit:200000, Pre Trigger Value:190000, Trigger %95, Utilization: 1,81,811
Consider there is an LTP change in TCS
  • Consider the TCS LTP changed to 2500 so, the TCS MTM Loss = 15000
  • INFY FUTSTK LTP is 1400, so the MTM profit is 4000
  • NET MTM Loss = 4000 - 15000 = -11000
  • Now the Total Utilization shall be 1,92,811 (181811 + 11000)
  • Pre got triggered, Margin utilization increased due to MTM utilization.
  • Set Limit:200000, Pre Trigger Value:1,90,000, Trigger %95, Utilization: 1,92,811
  • Pre Trigger events shall be activated
    • Case 5
      • Position to consider & Square-off = Segment: ALL FNO, Product: Carryforward and MCX, Product Carryforward
      • Margin Limit = Cash: 3,00,000
      • Margin MTM Utilization = Booked Profit: Tick, Booked Loss: Tick, Booked Profit - Option: Tick, Booked Loss - Option: Tick, Brokerage and Charges - Order Based, Option CFS limit - UnTick, Net Premium Payable-Tick
      • Pre Margin Square off Percentage = 80% and Margin Square off Percentage = 85%
      • Pre Trigger Event - Restrict Fresh Order & Restrict Position Conversion
      • Post Trigger Event - Restrict Fresh + Cancel Pending + Square-off open position & Restrict Position Conversion
Action/EventDetailsRemarks/System Response
Order1: Option Sell Daily Traded
  • Ord1: SELL-NSEFNO-OPTSTK-INFY-1400-CE-24/04/2025-Carry forward-Qty: 400, Price: 55
  • Individual Margin
    • Ord1: Expo: 19732 Span: 174660 Total Margin: 194392 Premium receivable: 22000
  • No Trigger.
  • Set Limit:300000, Pre Trigger: 240000; Post Trigger Value:255000, Utilization: 194392
  • Total margin utilization is 194392
Order2: Option Buy Traded(But different segment)
  • Ord2: BUY-MCX-OPTFUT-COPPER-905-24/10/2025-Carry forward-250001 lot=2500 qty, Price: 2.5
  • Premium Payable: 62500
  • In this case, Premium receivable is not get adjusted with the premium payable(as Ord-2 opt buy is not same segment)
  • Total Utilization= 194392+62500 = 256892
  • Here Post Trigger got hit.
  • Post Trigger events shall be activated.
  • Restrict Fresh + Cancel Pending + Square-off open position & Restrict Position Conversion shall be activated as per the Post Trigger Event.
  • Square-off shall be generated for all the open traded position.
    • Case 6
      • Position to consider & Square-off = Segment: ALL FNO, Product: Carryforward
      • Margin Limit = Cash: 4,00,000
      • Margin MTM Utilization = Booked Profit: Tick, Booked Loss: Tick, Booked Profit - Option: Tick, Booked Loss - Option: Tick, Brokerage and Charges - Order Based, Option CFS limit - UnTick, Net Premium Payable-Tick
      • Pre Margin Square off Percentage = 80% and Margin Square off Percentage = 85%
      • Pre Trigger Event - Restrict Fresh Order & Restrict Position Conversion
      • Post Trigger Event - Restrict Fresh + Cancel Pending + Square-off open position & Restrict Position Conversion
Action/EventDetailsRemarks/System Response
Order1: Option Sell Daily Traded
  • Ord1: SELL-NSEFNO-OPTSTK-INFY-1400-CE-24/04/2025-Carry forward-Qty: 400, Price: 160
    • Ord1: Expo: 21840 Span: 174660 Total Margin: 196500 Premium receivable: 64000
  • No Trigger.
  • Set Limit:400000, Pre Trigger: 320000; Post Trigger Value:340000, Utilization: 196500
Order2: Option Buy(Another scrip) Traded but same segment
  • Ord2: BUY-NSEFNO-OPTSTK-RELIANCE-2000-CE-24/04/2025-Carry forward-Qty: 500, Price: 40
  • Premium Payable: 20000
  • In this case, As Net Premium Payable is tick, Premium receivable is getting adjusted with the premium payable
  • Premium receivable of previous order=64000 and premium payable of current order is 20000 then net premium payable is 0(as it is a same segment, premium receivable will be adjusted)
  • Total Utilization= 196500
  • Since Utilization not reaches the trigger value, System will not restrict any orders.