Join our fan page
- Published by:
- Vladimir Karputov
- Views:
- 4488
- Rating:
- Published:
- 2018.10.25 15:46
-
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance
The author of the idea: Collector
MQL5 code author: barabashkakvn
The EA only operates when a new bar appears. A trading signal from the iBullsPower (Bulls Power) and iBearsPower (Bears Power) indicators is considered only if the market has no positions opened by the EA (the search is performed by the current symbol and the current unique EA identifier - magic number).
Both indicators feature only one setting - Bulls and Bears: averaging period. Trading signal forming algorithm: data from two bars - Bar current and Bar current+1 - are taken in both indicators and the values are divided by 2
double prev = ((bears[1]+bulls[1])/2.0); double curr = ((bears[0]+bulls[0])/2.0);
If the average value on the previous bar is less than on the current one, open BUY:
if(prev<curr && curr<0) { //ClosePositions(POSITION_TYPE_SELL); double sl=(InpStopLoss==0)?0.0:m_symbol.Ask()-ExtStopLoss; if(sl>=m_symbol.Bid()) // incident: the position isn't opened yet, and has to be already closed { PrevBars=0; return; } double tp=(InpTakeProfit==0)?0.0:m_symbol.Ask()+ExtTakeProfit; OpenBuy(sl,tp); return; }
If the average value on the previous bar exceeds the current one, open SELL:
if(prev>curr && curr>0) { //ClosePositions(POSITION_TYPE_BUY); double sl=(InpStopLoss==0)?0.0:m_symbol.Bid()+ExtStopLoss; if(sl<=m_symbol.Ask()) // incident: the position isn't opened yet, and has to be already closed { PrevBars=0; return; } double tp=(InpTakeProfit==0)?0.0:m_symbol.Bid()-ExtTakeProfit; OpenSell(sl,tp); return; }
EURUSD, M15:
Translated from Russian by MetaQuotes Ltd.
Original code: https://www.mql5.com/ru/code/22016

DeMarker_Histogram_Vol indicator with the timeframe selection option available in input parameters

The indicator of expanding time zone corridors with two corridors

HullTrend indicator with additional smoothing of the Hull moving average and rounding the values by the number of digits fixed in the input variables

The indicator of expanding time zone corridors