hey every one i want to make an expert
but my programing experience is zero
here is the details and i think this ea is not an easy job
so i thank everyone will help me and put some effort for this ea
note : after i write this thread and before posting it i found that i write a lot so i apologize if you found me poring
---------------------------------------------------------------------------
1-triger to open trades ( how trades are open )
***************************************
* let's say we will make a parameter called ( direction ) and we can chose either buy or sell
let's say i make it : buy
when we start the expert it will open a buy trade with stop 50 and target 100
if it hit target we will open another buy trade with sl 50 an tp 100 if it hit target we repeat the buy ( someone will say so why to close the first one this way you bay the spread for multiple time : i will answer this later when i illustrate the lot )
if it hit stop we will open a sell order from the same price where the stop of the buy were hit and this sell will be also with sl 50 and tp 100
if the sell hit stop we will open a buy from the same place where the stop were hit this buy has st50 and tp 100
but if the sell hit target we will not open another sell ( like the buy ) no we will open buy with st 50 ad tp 100
so let's summarize this part
- all trades with st 50 v tp 100 tareget: stop 1 : 2
- when the stop hit an opposite trade is opened from the place were the sl is hit the case is like a box it's wide is 50 pip we buy from the upper border and also the sell sl is there and sell from the lower border and also the buy sl will be hit
- when any trade either buy or sell hit target from the same price where the target where hit we open an order but it's type determined by the parameter called direction
this is the easy part as i think
****************************************************************
now the other part : lot calculation
//////////////////////////////////////////////
* we will use some kind of martingale
let's say the start balance is 10,000 $
i want to determine the sl as a percent from the balance
what does that mean ??
let's say the first trade will be a buy trade with sl 50 pip
and i choose (( in a parameter or excel sheet ) the stop of this trade to be 3% of the balance
the balance is 10000 the 3% equal 300 $ and the stop is 50 pip so the lot = 300/50 = 6 dollar per pip ( 0.6 )
- and also there will be a sequence for the martingale of trades
the sequence will be Fibonacci sequence : 1 1 2 3 5 8 13 21 .....etc
how ???
as we say the balance is 10000
so the first order ( let's say it's buy ) sl will equal 1% of the balance (10000) which equal to 100 $
if this trade win the balance will equal 10200
and we said before we will open another buy trade and it's sl will be 1% ( as the last trade was a wining one so we start the sequence from beginning )
but this time the balance is 10200 so the 1% sl will be 102 $
until here i think it's easy
the hard work is when we hit stop
as we say
the balance is 10000
and direction is buy
and the sequence of sl percents is 1 1 2 3 5 8 13 21
let's imagine how the expert will work
now let's see how the calculations work in case of trending market and wining traders
open first buy order ( market order ) ( order b1 ) with sl 1% of the 10000 ( original balance 1 ) and bending buy (b2) at the place of tp ( of order b1 ) with sl equal to 1% of ( the new balance after expected b1 wining ) ( 10200 ) and another bending sell (s1 ) at the balance of sl ( of order b1 ) with sl equal to 1% of ( original balance 1 ) ( 10000 ) not the new balance which will be 9900 ( because we lose )
now the market go up and order b1 win and we have a new balance (original balance 2 ) ( 10200 ) and the second buy ( order b2 ) triggered and it's sl is ( predetermined ) to equal 1% of ( original balance 2 ) 10200
when the second buy triggered ( b2 ) the expert will but another 2 pending orders
a buy order at the place of tp of ( order b2 ) with a sl equal to 1% of ( the new balance after expected b2 wining ) ( 10404 )
and a sell ( s2 ) order with sl equal to 1% of ( original balance 2 ) ( 10200 )
now let's see how the calculations work in case of consolidation market ( box border scenario ) and losing traders
open first buy order (market order) ( order b1 ) with sl 1% of the 10000 ( original balance 1 ) and bending buy at the place of tp ( of order b1 ) with sl equal to 1% of ( the new balance after expected b1 wining ) ( 10200 ) and another bending sell at the balance of sl ( of order b1 ) with sl equal to 1% of ( original balance 1 ) ( 10000 )
the market go down and order b1 hit sl we have a new balance 9900
the first sell order triggered ( s1 ) and as we mention it's sl equal to 1% of original balance ( 10000 )
once it triggered the expert will put 2 bending orders
a buy order (b3) at the place of sl of order s1 with a sl equal to 2% of original balance (10000 ) ( remember Fibonacci sequence 1 1 2 )
a buy order (b4) at the place of tp of order s1 ( remember the direction is up ) with a sl equal to 1% of (the new balance expected after s1 hit tp )
(10000 - 100( b1 lose) + 200 (s1 tp) = 10100 ) which we didn't reach yet but it's expected to be reached if order s1 hit tp
if s1 hit target and b4 activated this will be as we start from binging
if s1 hit sl the following happen
buy b3 will be triggered and the balance is now 9800 ( we lose 1% ( 100 $ ) in b1 and 1% in s1 )
here the expert will also but 2 bending orders
buy order ( b5 ) at the place of b3 tp and it's sl equal to the new expected balance ( after b3 hit tb ) which equal 9800 + 400 ( the 2% sl * 2 )=10200
a sell order ( s2) at the place of b3 sl with sl equal to 3% ( remember Fibonacci sequence 1 1 2 3 ) of original balance 10000
if target of b3 hit we have a new balance we start the Fibonacci sequence from beginning
if sl of b3 hit we continue the sequence of fibo
////////////////////////////////////
to summarize this big part ( sorry because my illustration was poring )
- when a target hit we open a trade as the predetermined direction ( in parameter ) and we have a new original balance that will be used in calculations and Fibonacci sequence start from beginning
- when a sl hit we use the last big balance and the Fibonacci sequence continue until a target is hit
- if the triggered trade is as the direction parameter we put a pending like it at the tp place and a pending opposite to it's type at the sl place
- if the triggered trade is opposite to the direction we put a pending order like the direction at the place of tp and sl
///////////////////////////////////////////////////////////
i think that we can use excel to facilitate the calculation of the lot instead of the expert making the calculation
i think it's possible to point the expert to certain cell in excel to take the lot from it
and make expert also write loses and profits to exel
**************************************************
waiting for you help
but my programing experience is zero
here is the details and i think this ea is not an easy job
so i thank everyone will help me and put some effort for this ea
note : after i write this thread and before posting it i found that i write a lot so i apologize if you found me poring
---------------------------------------------------------------------------
1-triger to open trades ( how trades are open )
***************************************
* let's say we will make a parameter called ( direction ) and we can chose either buy or sell
let's say i make it : buy
when we start the expert it will open a buy trade with stop 50 and target 100
if it hit target we will open another buy trade with sl 50 an tp 100 if it hit target we repeat the buy ( someone will say so why to close the first one this way you bay the spread for multiple time : i will answer this later when i illustrate the lot )
if it hit stop we will open a sell order from the same price where the stop of the buy were hit and this sell will be also with sl 50 and tp 100
if the sell hit stop we will open a buy from the same place where the stop were hit this buy has st50 and tp 100
but if the sell hit target we will not open another sell ( like the buy ) no we will open buy with st 50 ad tp 100
so let's summarize this part
- all trades with st 50 v tp 100 tareget: stop 1 : 2
- when the stop hit an opposite trade is opened from the place were the sl is hit the case is like a box it's wide is 50 pip we buy from the upper border and also the sell sl is there and sell from the lower border and also the buy sl will be hit
- when any trade either buy or sell hit target from the same price where the target where hit we open an order but it's type determined by the parameter called direction
this is the easy part as i think
****************************************************************
now the other part : lot calculation
//////////////////////////////////////////////
* we will use some kind of martingale
let's say the start balance is 10,000 $
i want to determine the sl as a percent from the balance
what does that mean ??
let's say the first trade will be a buy trade with sl 50 pip
and i choose (( in a parameter or excel sheet ) the stop of this trade to be 3% of the balance
the balance is 10000 the 3% equal 300 $ and the stop is 50 pip so the lot = 300/50 = 6 dollar per pip ( 0.6 )
- and also there will be a sequence for the martingale of trades
the sequence will be Fibonacci sequence : 1 1 2 3 5 8 13 21 .....etc
how ???
as we say the balance is 10000
so the first order ( let's say it's buy ) sl will equal 1% of the balance (10000) which equal to 100 $
if this trade win the balance will equal 10200
and we said before we will open another buy trade and it's sl will be 1% ( as the last trade was a wining one so we start the sequence from beginning )
but this time the balance is 10200 so the 1% sl will be 102 $
until here i think it's easy
the hard work is when we hit stop
as we say
the balance is 10000
and direction is buy
and the sequence of sl percents is 1 1 2 3 5 8 13 21
let's imagine how the expert will work
now let's see how the calculations work in case of trending market and wining traders
open first buy order ( market order ) ( order b1 ) with sl 1% of the 10000 ( original balance 1 ) and bending buy (b2) at the place of tp ( of order b1 ) with sl equal to 1% of ( the new balance after expected b1 wining ) ( 10200 ) and another bending sell (s1 ) at the balance of sl ( of order b1 ) with sl equal to 1% of ( original balance 1 ) ( 10000 ) not the new balance which will be 9900 ( because we lose )
now the market go up and order b1 win and we have a new balance (original balance 2 ) ( 10200 ) and the second buy ( order b2 ) triggered and it's sl is ( predetermined ) to equal 1% of ( original balance 2 ) 10200
when the second buy triggered ( b2 ) the expert will but another 2 pending orders
a buy order at the place of tp of ( order b2 ) with a sl equal to 1% of ( the new balance after expected b2 wining ) ( 10404 )
and a sell ( s2 ) order with sl equal to 1% of ( original balance 2 ) ( 10200 )
now let's see how the calculations work in case of consolidation market ( box border scenario ) and losing traders
open first buy order (market order) ( order b1 ) with sl 1% of the 10000 ( original balance 1 ) and bending buy at the place of tp ( of order b1 ) with sl equal to 1% of ( the new balance after expected b1 wining ) ( 10200 ) and another bending sell at the balance of sl ( of order b1 ) with sl equal to 1% of ( original balance 1 ) ( 10000 )
the market go down and order b1 hit sl we have a new balance 9900
the first sell order triggered ( s1 ) and as we mention it's sl equal to 1% of original balance ( 10000 )
once it triggered the expert will put 2 bending orders
a buy order (b3) at the place of sl of order s1 with a sl equal to 2% of original balance (10000 ) ( remember Fibonacci sequence 1 1 2 )
a buy order (b4) at the place of tp of order s1 ( remember the direction is up ) with a sl equal to 1% of (the new balance expected after s1 hit tp )
(10000 - 100( b1 lose) + 200 (s1 tp) = 10100 ) which we didn't reach yet but it's expected to be reached if order s1 hit tp
if s1 hit target and b4 activated this will be as we start from binging
if s1 hit sl the following happen
buy b3 will be triggered and the balance is now 9800 ( we lose 1% ( 100 $ ) in b1 and 1% in s1 )
here the expert will also but 2 bending orders
buy order ( b5 ) at the place of b3 tp and it's sl equal to the new expected balance ( after b3 hit tb ) which equal 9800 + 400 ( the 2% sl * 2 )=10200
a sell order ( s2) at the place of b3 sl with sl equal to 3% ( remember Fibonacci sequence 1 1 2 3 ) of original balance 10000
if target of b3 hit we have a new balance we start the Fibonacci sequence from beginning
if sl of b3 hit we continue the sequence of fibo
////////////////////////////////////
to summarize this big part ( sorry because my illustration was poring )
- when a target hit we open a trade as the predetermined direction ( in parameter ) and we have a new original balance that will be used in calculations and Fibonacci sequence start from beginning
- when a sl hit we use the last big balance and the Fibonacci sequence continue until a target is hit
- if the triggered trade is as the direction parameter we put a pending like it at the tp place and a pending opposite to it's type at the sl place
- if the triggered trade is opposite to the direction we put a pending order like the direction at the place of tp and sl
///////////////////////////////////////////////////////////
i think that we can use excel to facilitate the calculation of the lot instead of the expert making the calculation
i think it's possible to point the expert to certain cell in excel to take the lot from it
and make expert also write loses and profits to exel
**************************************************
waiting for you help