<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<Strategy xmlns="http://www.fixprotocol.org/FIXatdl-1-1/Core"
          xmlns:val="http://www.fixprotocol.org/FIXatdl-1-1/Validation"
          xmlns:lay="http://www.fixprotocol.org/FIXatdl-1-1/Layout"
          xmlns:flow="http://www.fixprotocol.org/FIXatdl-1-1/Flow"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.fixprotocol.org/FIXatdl-1-1/Core tt-fixatdl-core-1-1.xsd"
          name="TT_PROWLER"
          uiRep="TT Prowler"
          providerID="RCM"
          subtypeList="RCM,RCM2,RCM-LN,RCM-FF,RCM-SG"
          version="1.11">
 
    <Description>Seeks to reduce market impact by constraining the size of passively priced child orders exposed to the market. Aggressive child orders take visible liquidity, passive child orders post with at most MaxShow quantity, optionally randomizing between MinShow and MaxShow. PassivePriceLevel may optionally be set for passive pegging behavior.</Description>

    <Parameter xsi:type="String_t" name="strategyIdentifierTag" fixTag="9100" constValue="PROWLER" definedByFIX="true" use="required" revertOnCxlRpl="true" mutableOnCxlRpl="false" />

    <!-- Order type -->
    <Parameter name="__type" xsi:type="Int_t" initValue="eMarket" required="true" dir="In" updateable="false">
        <EnumPair enumID="eMarket" wireValue="1"/>
        <EnumPair enumID="eLimit" wireValue="2"/>
        <EnumPair enumID="eStop" wireValue="3"/>
        <EnumPair enumID="eStopLimit" wireValue="4"/>
    </Parameter>

    <Parameter name="StopPrice" xsi:type="Price_t" minValue="0" fixTag="99" use="optional"/>

    <Parameter name="MaxShow" uiRep="Max Show" xsi:type="Qty_t" fixTag="9210" orderEntryFixtag="9210" use="required" mutableOnCxlRpl="true" updateable="true" minValue="0" />
    <Parameter name="MinShow" uiRep="Min Show" xsi:type="Qty_t" fixTag="9211" orderEntryFixtag="9211" use="optional" mutableOnCxlRpl="true" updateable="true" minValue="0" />

    <Parameter name="PassivePriceLevel" fixTag="9212" orderEntryFixtag="9212" use="optional" mutableOnCxlRpl="true" updateable="true" xsi:type="Int_t">
        <EnumPair enumID="NoPegging" wireValue="0" />
        <EnumPair enumID="Peg1" wireValue="1" />
        <EnumPair enumID="Peg2" wireValue="2" />
        <EnumPair enumID="Peg3" wireValue="3" />
        <EnumPair enumID="Peg4" wireValue="4" />
        <EnumPair enumID="Peg5" wireValue="5" />
        <EnumPair enumID="Peg6" wireValue="6" />
    </Parameter>

    <Parameter name="NumPostLevels" uiRep="Num Post Levels" fixTag="9213" orderEntryFixtag="9213" use="optional" mutableOnCxlRpl="true" updateable="true" xsi:type="Int_t">
        <EnumPair enumID="null" wireValue="{NULL}" />
        <EnumPair enumID="one" wireValue="1" />
        <EnumPair enumID="two" wireValue="2" />
        <EnumPair enumID="three" wireValue="3" />
        <EnumPair enumID="four" wireValue="4" />
        <EnumPair enumID="five" wireValue="5" />
    </Parameter>

    <Parameter name="AverageDelay" uiRep="Average Delay" xsi:type="Float_t" fixTag="9214" orderEntryFixtag="9214" use="optional" mutableOnCxlRpl="true" updateable="true" minValue="0"/>
    <Parameter name="IWouldQty" uiRep="I Would Quantity" xsi:type="Qty_t" fixTag="9215" orderEntryFixtag="9215" use="optional" mutableOnCxlRpl="true" updateable="true"  minValue="0" maxValue="1000000"/>
    <Parameter name="IWouldQtyPct" uiRep="I Would Quantity Pct" xsi:type="Float_t" fixTag="9216" orderEntryFixtag="9216" use="optional" mutableOnCxlRpl="true" updateable="true" minValue="0" maxValue="10000"/>
    <Parameter name="BriskLimitMode" uiRep="Brisk Limit Mode" fixTag="9115" orderEntryFixtag="9115" use="optional" mutableOnCxlRpl="true" xsi:type="Int_t">
        <EnumPair enumID="null" wireValue="{NULL}" />
        <EnumPair enumID="Off" wireValue="0" />
        <EnumPair enumID="AggressMoreAtLimit" wireValue="1" />
    </Parameter>
    <Parameter name="StartTime" uiRep="Start Time" xsi:type="UTCTimestamp_t" fixTag="9101" use="optional" orderEntryFixtag="168"/>
    <Parameter name="EndTime" uiRep="End Time" xsi:type="UTCTimestamp_t" fixTag="9102" use="optional" orderEntryFixtag="126"/>
    <Parameter name="Duration" xsi:type="Int_t" fixTag="9202" orderEntryFixtag="9202" use="optional" updateable="true"/>

    <Parameter name="TriggerPrice" xsi:type="Price_t" minValue="0" fixTag="9190" orderEntryFixtag="9190" use="optional"/>
    <Parameter name="PostTriggerDuration" xsi:type="Int_t" fixTag="9191" orderEntryFixtag="9191" use="optional"/>

    <Parameter name="WithATickQty" xsi:type="Qty_t" fixTag="9217" orderEntryFixtag="9217" use="optional"  precision="0"/>
    <Parameter name="WithATickQtyPct" xsi:type="Int_t" fixTag="9218" orderEntryFixtag="9218" minValue="0" maxValue="10000" use="optional"  precision="0"/>

    <!-- GUI Layout -->
	<lay:StrategyLayout>

        <!-- Order Details -->
        <lay:StrategyPanel title="ParametersPanel" orientation="VERTICAL" class="main-panel">
            <lay:Control ID="Parameters_label" xsi:type="lay:Label_t" label="Order Details" class="atdl-panel-title"/>
            <lay:StrategyPanel orientation="VERTICAL" class="gradient-block">

                <!-- Order type -->
                <lay:StrategyPanel  orientation="HORIZONTAL">
                    <lay:Control ID="OrderTypeTogglePriceDropdown" parameterRef="__type" xsi:type="lay:DropDownList_t" initValue="eMarket" label="Order Type">
                    <lay:ListItem enumID="eMarket" uiRep="Market order"/>
                    <lay:ListItem enumID="eLimit" uiRep="Limit order"/>
                    <lay:ListItem enumID="eStop" uiRep="Stop order"/>
                    <lay:ListItem enumID="eStopLimit" uiRep="Stop Limit order"/>
                    </lay:Control>
                </lay:StrategyPanel>

                <lay:StrategyPanel name="StopPricePanel" orientation="HORIZONTAL">
                    <flow:StateRule visible="true">
                        <val:Edit logicOperator="OR">
                            <val:Edit field="OrderTypeTogglePriceDropdown" operator="EQ" value="eStop"/>
                            <val:Edit field="OrderTypeTogglePriceDropdown" operator="EQ" value="eStopLimit"/>
                        </val:Edit>
                    </flow:StateRule>
                    <lay:Control ID="StopPrice_ctrl" parameterRef="StopPrice" xsi:type="lay:SingleSpinner_t" initValue="0" label="Stop Price">
                    </lay:Control>
                </lay:StrategyPanel>

                <lay:StrategyPanel orientation="HORIZONTAL">
                    <lay:Control ID="MaxShowField" xsi:type="lay:SingleSpinner_t" label="Max Show" parameterRef="MaxShow" increment="1"
                        tooltip="Maximum quantity for passive child orders."/>
                </lay:StrategyPanel> 

                <lay:StrategyPanel orientation="HORIZONTAL">
                    <lay:Control ID="MinShowField" xsi:type="lay:SingleSpinner_t" label="Min Show" parameterRef="MinShow" increment="1"
                        tooltip="Minimum quantity for passive child orders, blank or 0 for no randomization."/>
                </lay:StrategyPanel> 

                <lay:StrategyPanel orientation="VERTICAL">
                    <lay:Control ID="PassivePriceLevelField_ctrl" xsi:type="lay:DropDownList_t" initValue="null" label="Passive Price Lvl" parameterRef="PassivePriceLevel"
                        tooltip="Optionally passively peg child orders to the 1st, 2nd, or 3rd price level in the book.">
                        <lay:ListItem enumID="NoPegging" uiRep="No Pegging"/>
                        <lay:ListItem enumID="Peg1" uiRep="Primary Peg"/>
                        <lay:ListItem enumID="Peg2" uiRep="Second Level Peg"/>
                        <lay:ListItem enumID="Peg3" uiRep="Third Level Peg"/>
                        <lay:ListItem enumID="Peg4" uiRep="Primary Plus 1"/>
                        <lay:ListItem enumID="Peg5" uiRep="Primary Plus 2"/>
                        <lay:ListItem enumID="Peg6" uiRep="Primary Plus 3"/>
                    </lay:Control>
                </lay:StrategyPanel>

                <lay:StrategyPanel orientation="VERTICAL">
                    <lay:Control ID="NumPostLevelsField" xsi:type="lay:DropDownList_t" label="Num Post Levels" parameterRef="NumPostLevels"
                        tooltip="Can be set above 1 when PassivePriceLevel set for pegging to post orders at multiple price levels.">
                        <lay:ListItem enumID="null" uiRep="Default"/>
                        <lay:ListItem enumID="one" uiRep="1"/>
                        <lay:ListItem enumID="two" uiRep="2"/>
                        <lay:ListItem enumID="three" uiRep="3"/>
                        <lay:ListItem enumID="four" uiRep="4"/>
                        <lay:ListItem enumID="five" uiRep="5"/>
                    </lay:Control>
                </lay:StrategyPanel>

                <lay:StrategyPanel orientation="HORIZONTAL">
                    <lay:Control ID="AverageDelayField" xsi:type="lay:TextField_t" label="Average Delay" parameterRef="AverageDelay"
                        tooltip="Sets a random delay (in seconds) between sending new or replacing existing child orders, blank or 0 means no delay."/>
                </lay:StrategyPanel>

                <lay:StrategyPanel orientation="HORIZONTAL">
                    <lay:Control ID="IWouldQtyField" xsi:type="lay:SingleSpinner_t" label="I Would Qty" parameterRef="IWouldQty" increment="1"
                        tooltip="Minimum top of book quantity required before PROWLER will cross the spread. If greater than zero, PROWLER will opportunistically cross the spread even if passively pegging."/>
                </lay:StrategyPanel>

                <lay:StrategyPanel orientation="HORIZONTAL">
                    <lay:Control ID="IWouldQtyPctField" xsi:type="lay:TextField_t" label="I Would Qty %" parameterRef="IWouldQtyPct"
                        tooltip="IWouldQty as percent of OrderQty, rounded up. 100 signifies 100%."/>
                </lay:StrategyPanel>

                <lay:StrategyPanel orientation="HORIZONTAL">
                    <lay:Control ID="BriskLimitModeField" xsi:type="lay:DropDownList_t" label="Brisk Limit Mode" parameterRef="BriskLimitMode"
                        tooltip="Get more aggressive when opposite quote price equals the limit price to get more done before quoted prices are no longer marketable.">
                        <lay:ListItem enumID="null" uiRep="Default"/>
                        <lay:ListItem enumID="Off" uiRep="Off"/>
                        <lay:ListItem enumID="AggressMoreAtLimit" uiRep="AggressMoreAtLimit"/>
                    </lay:Control>
                </lay:StrategyPanel>

                <lay:StrategyPanel orientation="HORIZONTAL">
                    <lay:Control ID="WithATickQtyValue" xsi:type="lay:SingleSpinner_t" label="With A Tick Qty" parameterRef="WithATickQty" increment="1"
                        tooltip="With PassivePriceLevel pegging engaged, opportunistically cross spread if opposite quote quantity falls to or below WithATickQty"/>
                </lay:StrategyPanel>

                <lay:StrategyPanel orientation="HORIZONTAL">
                    <lay:Control ID="WithATickQtyPctValue" xsi:type="lay:SingleSpinner_t" label="With A Tick Qty %" parameterRef="WithATickQtyPct" increment="1"
                        tooltip="WithATickQty as percent of OrderQty, rounded down. 100 signifies 100%."/>
                    <lay:Control ID="WithATickQtyPctLabel" xsi:type="lay:Label_t" label="%"/>
                </lay:StrategyPanel>

            </lay:StrategyPanel>
        </lay:StrategyPanel>

        <!-- Precondition Details -->
        <lay:StrategyPanel name="PreconditionDetailsPanel" orientation="VERTICAL" class="main-panel">
            <lay:Control ID="PreconditionDetails_label" xsi:type="lay:Label_t" label="Precondition Details" class="atdl-panel-title"/>
            <lay:StrategyPanel orientation="VERTICAL" class="gradient-block">
                    
                <!-- TT Custom Time Layout Section -->
                <lay:Control ID="Start" xsi:type="lay:DropDownList_t" initValue="eNow" label="Start Time">
                    <lay:ListItem enumID="eNow" uiRep="Now"/>
                    <lay:ListItem enumID="eTime" uiRep="Time"/>
                </lay:Control>

                <lay:StrategyPanel name="StartTimeControlPanel" orientation="HORIZONTAL">
                    <flow:StateRule visible="true">
                        <val:Edit field="Start" operator="EQ" value="eTime"/>
                    </flow:StateRule>
                    <lay:Control ID="c_dummy_1" xsi:type="lay:HiddenField_t"> </lay:Control>
                    <lay:Control ID="StartTimeClock" parameterRef="StartTime" xsi:type="lay:Clock_t" initValueMode="1"/>
                </lay:StrategyPanel>

                <lay:StrategyPanel orientation="HORIZONTAL" >
                    <lay:Control ID="End" xsi:type="lay:DropDownList_t" initValue="eDuration" label="End Time">
                        <lay:ListItem enumID="eDuration" uiRep="Duration"/>
                        <lay:ListItem enumID="eTime" uiRep="Time"/>
                    </lay:Control>
                </lay:StrategyPanel>

                <lay:StrategyPanel name="EndDurationControlPanel" orientation="HORIZONTAL" indent="true">
                    <flow:StateRule visible="true">
                        <val:Edit field="End" operator="EQ" value="eDuration"/>
                    </flow:StateRule>
                    <lay:Control ID="control_1" xsi:type="lay:HiddenField_t"/>
                    <lay:Control ID="Duration_ctrl" parameterRef="Duration" xsi:type="lay:TextField_t" initValue=""/> 
                    <lay:Control ID="MinutesLabel" xsi:type="lay:Label_t" label="minutes"/>
                </lay:StrategyPanel>

                <lay:StrategyPanel name="EndTimeControlPanel" orientation="HORIZONTAL">
                    <flow:StateRule visible="true">
                        <val:Edit field="End" operator="EQ" value="eTime"/>
                    </flow:StateRule>
                    <lay:Control ID="control_1" xsi:type="lay:HiddenField_t"> </lay:Control>
                    <lay:Control ID="ExpireTime_ctrl" parameterRef="EndTime" xsi:type="lay:Clock_t" initValueMode="1" initValue="{now}"/>
                </lay:StrategyPanel> 

                <lay:StrategyPanel orientation="HORIZONTAL">
                    <lay:Control ID="TriggerPriceField" xsi:type="lay:SingleSpinner_t" parameterRef="TriggerPrice" label="Trigger Price" increment="1"
                        tooltip="If set, BUY(SELL) order activates once LastTradePx less(greater) than or equal to Trigger Price."/>
                </lay:StrategyPanel>

                <lay:StrategyPanel orientation="HORIZONTAL">
                    <lay:Control ID="PostTriggerDuration" xsi:type="lay:TextField_t" label="Post Trigger Dur" parameterRef="PostTriggerDuration" initValue=""
                        tooltip="If set to positive value, max minutes to work order after StopPrice or TriggerPrice reached."/>
                    <lay:Control ID="MinutesLabel" xsi:type="lay:Label_t" label="minutes"/>
                </lay:StrategyPanel>

            </lay:StrategyPanel>
        </lay:StrategyPanel>

    </lay:StrategyLayout>

    <!-- TT Clock Input Validation -->
    <val:StrategyEdit errorMessage="End Time should be later than Start Time">
        <val:Edit logicOperator="OR">
            <val:Edit field="StartTime" operator="NX"/>
            <val:Edit field="EndTime" operator="NX"/>
            <val:Edit field="EndTime" operator="GT" field2="StartTime"/>
        </val:Edit>
    </val:StrategyEdit>

    <val:StrategyEdit errorMessage="Use of Duration and End Time not allowed">
        <val:Edit logicOperator="OR">
            <val:Edit field="Duration" operator="NX"/>
            <val:Edit field="EndTime" operator="NX"/>
        </val:Edit>
    </val:StrategyEdit>

    <val:StrategyEdit errorMessage="If entered, Min Show must be less or equal to Max Show">
        <val:Edit logicOperator="OR">
            <val:Edit field="MinShow" operator="NX"/>
            <val:Edit field="MinShow" operator="LE" field2="MaxShow"/>
        </val:Edit> 
	</val:StrategyEdit>

    <val:StrategyEdit errorMessage="With A Tick Qty %  must be in the range 0 to 10000.">
        <val:Edit logicOperator="OR">
            <val:Edit field="WithATickQtyPct" operator="NX" />
            <val:Edit logicOperator="AND">
                <val:Edit field="WithATickQtyPct" operator="GE" value="0" />
                <val:Edit field="WithATickQtyPct" operator="LE" value="10000" />
            </val:Edit>
        </val:Edit>
    </val:StrategyEdit>

    <val:StrategyEdit errorMessage="I Would Qty %  must be in the range 0 to 10000.">
        <val:Edit logicOperator="OR">
            <val:Edit field="IWouldQtyPct" operator="NX" />
            <val:Edit logicOperator="AND">
                <val:Edit field="IWouldQtyPct" operator="GE" value="0" />
                <val:Edit field="IWouldQtyPct" operator="LE" value="10000" />
            </val:Edit>
        </val:Edit>
    </val:StrategyEdit>

</Strategy>
