Hello guys,
I'm lurking this forum from January when I started to "play" with Forex and EA coding...
Now after 3 months of work I 'm close to finish v1.0 of my little EA (PipDefender) and I would like to share it with you in order to know your ideas and opinions about it.
Normally I use a scalping EA in order to identify and open a profitable position, then PipDefender to follow the opened order and manage it.
Why? Because I was not fully satisfied about the management of an already open order... so I coded PipDefender with "good sense" rules and.. well yes it works.
The idea behind PipDefender is very simple (and probably not so original... but I do not care too much): with a trailing stop-like technique place profitable stop losses in order to maximize the profit.
I coded two algorithms in PipDefender; two different modes to manage a buy or sell order: Fibonacci Progression and Standard Mode
Here a little parameters explanation :
FIBONACCI_MODE
Enable / disable the placement of a profitable stop loss following the Fibonacci progression at 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987 PIP. I found this kind of placement very interesting... that's why I added to PipDefender.
When FIBONACCI_MODE = false the Standard Mode algorithm takes place:
TRAILING_STOP
It's the first profit interval of the Standard Mode algorithm... roughly it's equivalent to the "take profit" of a classical stop loss/take profit management.
For instance: with TRAILING_STOP=5 pip and a broker stop level = 2 pip, the first profitable stop loss will be placed at 5 pip when the order profit
is 5 + 2 = 7 pip.
GREEDY_MODE
Enable / disable the greedy mode.
With the GREEDY_MODE = false the following profitable stop losses are placed at integer multiples of the base TRAILING_STOP parameter.
If TRAILING_STOP = 5 the next levels are placed at 10 (when the order profit is 10 + stop level) 15 (when the order profit is 15 + stop level) and so on.
With the GREEDY_MODE=true instead, if the actual order profit is greater than GREEDY_LEVEL * TRAILING_STOP pip the next profitable stop loss will be placed in order to maximize the profit.
GREEDY_LEVEL
It's the maximum number of "trailing stop" intervals managed with the trailing-stop like algorithm. For profits greater than GREEDY_LEVEL * TRAILING_STOP pip the greedy algorithm will try to maximize the order profit instead of placing stop losses every TRAILING_STOP pip.
For example: with GREEDY_MODE=TRUE, GREEDY_LEVEL=3, TRAILING_STOP=5 the first 3 levels are managed trying to set the stop losses at 5-10-15 pip (when possible of course),
In case of a profit greater than 15 pip (for example in case of a spike at +21 pip profit) the greedy algortihm will set a stop level at 21 - stop level (21-2=19 in the previous example) pip.
STEALTH_MODE
Enable / disable the stealth mode.
With STEALTH_MODE = true, the stop loss and take profit level of a nonprofitable order are changed to fake levels (FAKE_SL and FAKE_TP parameters).
The TRUE_SL parameter will be the true order stop loss. Your Broker don't know the TRUE_SL value... so "random" spikes just to hit your stop loss start to be more difficult to calculate...
With the STEALTH_MODE = true PipDefender must be the only EA allowed to change an order stop loss / take profit. This is not a problem if you or another EA change the order levels 1 time.. the big trouble to avoid is fight between EAs in order to change these levels
SAFE_MODE
Enable / disable the safe mode.
With the Safe mode enabled, when an order remains open for a period of time > MAX_HOURS_WARNING but < MAX_HOURS_ALARM that order will be closed if:
- is not managed by the Fibonacci / Standard algorithm (it means that no profitable stop losses are set)
- its profit is >=0
- its profit is <= 3 + stop level pip if the Fibonacci mode is on
- its profit is <= TRAILING_STOP + stop level if the standard mode is on
When an order is still open after MAX_HOURS_ALARM PipDefender will try to close it with a maximum loss of SAFE_LOSS pips.
CLOSE_SLIPPAGE
Nothing more than the slippage of a CloseOrder command (Close order commands are sent by Safe mode, Standard mode and Fibonacci mode algorithms)
--------------
Installation notes:
unzip the archive, move the dll inside your expertslibraries folder and the ex4 file inside the expert folder.
Well... that's all ... are you still here?
Jokes apart... sry for my bad english!
Thx in advance, and let me know your opinions or critics.
And last but not least... yes, I'm actively using PipDefender on my real money account.
EDIT: I removed the attached PipDefender EA, for the new version check the last post in this thread.
I'm lurking this forum from January when I started to "play" with Forex and EA coding...
Now after 3 months of work I 'm close to finish v1.0 of my little EA (PipDefender) and I would like to share it with you in order to know your ideas and opinions about it.
Normally I use a scalping EA in order to identify and open a profitable position, then PipDefender to follow the opened order and manage it.
Why? Because I was not fully satisfied about the management of an already open order... so I coded PipDefender with "good sense" rules and.. well yes it works.
The idea behind PipDefender is very simple (and probably not so original... but I do not care too much): with a trailing stop-like technique place profitable stop losses in order to maximize the profit.
I coded two algorithms in PipDefender; two different modes to manage a buy or sell order: Fibonacci Progression and Standard Mode
Here a little parameters explanation :
FIBONACCI_MODE
Enable / disable the placement of a profitable stop loss following the Fibonacci progression at 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987 PIP. I found this kind of placement very interesting... that's why I added to PipDefender.
When FIBONACCI_MODE = false the Standard Mode algorithm takes place:
TRAILING_STOP
It's the first profit interval of the Standard Mode algorithm... roughly it's equivalent to the "take profit" of a classical stop loss/take profit management.
For instance: with TRAILING_STOP=5 pip and a broker stop level = 2 pip, the first profitable stop loss will be placed at 5 pip when the order profit
is 5 + 2 = 7 pip.
GREEDY_MODE
Enable / disable the greedy mode.
With the GREEDY_MODE = false the following profitable stop losses are placed at integer multiples of the base TRAILING_STOP parameter.
If TRAILING_STOP = 5 the next levels are placed at 10 (when the order profit is 10 + stop level) 15 (when the order profit is 15 + stop level) and so on.
With the GREEDY_MODE=true instead, if the actual order profit is greater than GREEDY_LEVEL * TRAILING_STOP pip the next profitable stop loss will be placed in order to maximize the profit.
GREEDY_LEVEL
It's the maximum number of "trailing stop" intervals managed with the trailing-stop like algorithm. For profits greater than GREEDY_LEVEL * TRAILING_STOP pip the greedy algorithm will try to maximize the order profit instead of placing stop losses every TRAILING_STOP pip.
For example: with GREEDY_MODE=TRUE, GREEDY_LEVEL=3, TRAILING_STOP=5 the first 3 levels are managed trying to set the stop losses at 5-10-15 pip (when possible of course),
In case of a profit greater than 15 pip (for example in case of a spike at +21 pip profit) the greedy algortihm will set a stop level at 21 - stop level (21-2=19 in the previous example) pip.
STEALTH_MODE
Enable / disable the stealth mode.
With STEALTH_MODE = true, the stop loss and take profit level of a nonprofitable order are changed to fake levels (FAKE_SL and FAKE_TP parameters).
The TRUE_SL parameter will be the true order stop loss. Your Broker don't know the TRUE_SL value... so "random" spikes just to hit your stop loss start to be more difficult to calculate...
With the STEALTH_MODE = true PipDefender must be the only EA allowed to change an order stop loss / take profit. This is not a problem if you or another EA change the order levels 1 time.. the big trouble to avoid is fight between EAs in order to change these levels
SAFE_MODE
Enable / disable the safe mode.
With the Safe mode enabled, when an order remains open for a period of time > MAX_HOURS_WARNING but < MAX_HOURS_ALARM that order will be closed if:
- is not managed by the Fibonacci / Standard algorithm (it means that no profitable stop losses are set)
- its profit is >=0
- its profit is <= 3 + stop level pip if the Fibonacci mode is on
- its profit is <= TRAILING_STOP + stop level if the standard mode is on
When an order is still open after MAX_HOURS_ALARM PipDefender will try to close it with a maximum loss of SAFE_LOSS pips.
CLOSE_SLIPPAGE
Nothing more than the slippage of a CloseOrder command (Close order commands are sent by Safe mode, Standard mode and Fibonacci mode algorithms)
--------------
Installation notes:
unzip the archive, move the dll inside your expertslibraries folder and the ex4 file inside the expert folder.
Well... that's all ... are you still here?
Jokes apart... sry for my bad english!
Thx in advance, and let me know your opinions or critics.
And last but not least... yes, I'm actively using PipDefender on my real money account.
EDIT: I removed the attached PipDefender EA, for the new version check the last post in this thread.