Job finished
Specification
Will need source code for EA.
Variables user input:
Marketopentime
Sessionstarttime
Balance
Tickspec ($)
Risk% or fixed contracts (allow users to pick one)
Tradecycles=set max cycle of trades. (calculate how many cycle of trades have been taken. Only count when trade hits TP)
Calculate levels to draw:
Determine the range from highest High to the lowest Low between Marketopentime to Sessionstarttime
Draw out 25% levels between the High and Low. Should be 3 levels between High/Low (25%, 50%, 75%) and 5 levels out from High/Low (125%,150%,175%,200%, 225% and –25%, -50%, -75%,-100%,-125%)
10%range=Calculate the 10% of the range in ticks (High-Low)*4 –use standard rounding
These levels are FIXED until trade has hit TP in profit
Size = risk% x balance (in $)
$pertick =size / 10%range (in $)
Contracts = $pertick/tickspec (round up to nearest integer)
TRADE #1
Place limit orders using contracts at calculated High and Low (buy limit at low, sell limit at high)*
Target1=high-1 level or low+1 level
*Cancel other limit order when one is hit
Stop and reverse order at high+2 levels or low-2levels (double contracts since this is stop and reverse)
Calculate new levels right after trade #1 hit tp
TRADE #2 (if trade #1 stopped out)
Calculate loss from previous trade in ticks
Loss1 = calculate the loss PnL from previous trade in $
Target2=loss1/(contracts*tick spec)+10%range (basically loss in ticks+10%range)
Place limit orders at drawn levels from before
Add limit orders with contracts at previous drawn levels and update new target2 until target is hit. With additional contracts, the target gets smaller per the Target2 calculation above.
Reset timer to next hour after TP for trade #2 is hit
Example 1
Red line = sessionstarttime
Balance=$5000
Tickspec=$1.25
Risk%=0.5% or 0.005
Calculated High=4297.25
Calculated Low=4284.75
Draw out 25% levels
Calculate the 10%range from High/Low
Calculated contracts =4
Draw out the levels (basically at 25%, 50%, 75% between high and low) then every 25% above high and below low (5 levels both sides). Total 13 levels
Update levels right after TP
EXAMPLE 2
Balance=$5000
Tickspec=$1.25
Risk%=0.5% or 0.005
Calculated High=4300.75
Calculated Low=4284.75
Draw out 25% levels
Calculate the 10%range from High/Low
Calculated contracts =4
Draw out levels (25%, 50%, 75%) and 5 levels above high and below low
Limit order 4 contracts at 4284.75. Target 4288.75, stopandreverse 4276.75 for long, and 4309 for short.
Long triggered (cancel short limit)
Actual loss was 4284.75-4276.5 (slip in this case) = 33
10%range = 6
Totaltarget on trade#2 = 39 ticks or 4266.75
Reset timer to next hour: example if TP is hit at 1:57, reset at 2 to draw out new levels and restart the cycle. If TP is hit at 2:07, reset at 3. If TP is hit on the hour, reset next hour as well
EXAMPLE 3
Balance=$5000
Tickspec=$1.25
Risk%=0.5% or 0.005
Calculated High=4465.00
Calculated Low=4432.75
Draw out 25% levels
Calculate the 10%range from High/Low
Calculated contracts =2
Draw out levels (25%, 50%, 75%) and 5 levels above high and below low
Limit order short 2 contracts at 4465 TP 4457 stopreverse 4481.25, Limit order long 2 contracts at 4432.75 TP 4441.
Short triggered (cancel long limit).
Stop and reverse at 4481.25 (double contracts to reverse position)
Loss ticks = (exit price (actual entry of reverse price) - entry price) x 4 = 65 ticks
PnL loss = lossticks*previous contract*1.25 = $162.5
Calculated 10%range=13 ticks
But added positions at 4473.25, 4465, 4457 = 8 contracts total
Calculate TP for 2nd trade=
162.5 / (8*1.25) = 16.25 = 17 ticks (roundup to nearest integer)
Average price with 8 contracts = 4469.25
Target with 8 contracts = 4486.25
Reset timer to next hour: example if TP is hit at 1:57, reset at 2 to draw out new levels and restart the cycle. If TP is hit at 2:07, reset at 3.