Job finished
Specification
hi,
the job requires some accurate functions to executed at right time so please pay much attention..,main functions are like placing pending hedge orders , placing those orders again at same price, other functions are TP , SL , Break even and trailing.
at the start ea will place pending hedged positions at a given distance from the open of current candle , orders will be placed above and below with same given distance.,this edit able function will be defined as the start distance.
suppose ..current candle open is 1.09200
start distance is 150 so the first buysell will be placed above at 1.09350 and also a buysell below at 1.09050...
also will be a setting to define number of orders and order step to define the distance between orders.so if the number of orders is 2 and order step is 100
2nd buysell will be placed above at 1.09450 and 2nd buysell below at 1.08950..
if market goes to one side and opens first buysell the orders placed at other side will be moved close to opened order to a distance which is given as order step...it will be like........
candle open = 1.09500
first distance = 150
order step = 100
number of orders = 2
so first buysell above will be at 1.09650
2nd buysell will be at 1.09750
below first buysell will be at at 1.09350
2nd will be at 1.09250
so when market goes high to hit the first buysell at 1.09650 the below orders will be moved up to 1.90650..as the order step is 100 so these orders will be moved to 100 pips below from the above opened orders.
same way if market hits the lower orders the upper orders will be moved below to 100 pip closer from opened orders.in simple the upper and lower orders will come close to each other at the distance of order step.
if the current candle can not reach and open any of the above and below orders ,,the orders will be deleted at the end of the candle and placed again by the opening price of next candle.
please keep in mind the buysell orders will be spread sensitive,,there should be a setting to set the spread..so if the spread is set to .8 then this will make hedge orders to be placed as
if buy stop is at 1.09350 then sell limit will be at 1.09342 and in the same way ..if the sell stop is at 1.09050 the buy limit will be at 1.09042 .the only thing required by this function is that there should not be a situation when ea opens a buy and sell is missed due to spread or a sell is opened and buy is missed,,so you can cover this function buy setting the ea to always open a buy+sell because single order will be never opened..
so every order will be in the form of a pair of buy+sell and 2 functions below are the most important..
1: every order will use break ,sl, tp and trail but ..when both the orders are opened there will be only break even ..
sl , tp , and trail will only be activated when one of the orders has hit the break even and is closed.
suppose ..buy+sell was opened at 1.09200 at this point only break even will be activated for both positions. so if break even is 100 now say price goes high to 1.09300 and break even for buy position is active..till then no sl,tp or trail will be active . now if market comes back and hits the break even and buy position is closed this is the moment when tp ,sl and trail will be activated for the remaining sell position. so in short at first the buysell will only activate breakeven and when any of them is closed by hitting the break even so sl,tp and trail will be activated for the other position.
2::
when breakeven is activated for any of the position pending buy+sell will be placed again same at the price of previous buy+sell.
say ,,buysell was placed at 1.09300 after opening these orders market goes high and breakeven for buy is active so at that time a buy+sell will be placed again at 1.09300.
when all the previous positions are closed ea will again start from first step.
hope i am clear enough here...thanks