You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
If the solution is just a little programming trick, I think this thread does not have any purpose.
If you are sharing only ex4 code, we can not check if there is any improvement.
Wanting not to expose the community ideas, so they are not used for commercial purposes it leads to results as Range EA released here.
With the worst aspect I've ever seen, All candles are separated by gaps.Everything is a little programming trick if you think this way. If little programming tricks have no purposes, you should avoid half of this forum.
I have code distributed among many files. If I printed out the main file content:
#property indicator_buffers 3
#property indicator_color1 LightSeaGreen
#property indicator_color2 LightSeaGreen
#property indicator_color3 LightSeaGreen
//--- indicator parameters
input int InpKeltnerPeriod = 10; // Period to count
input int InpKeltnerShift = 0; // Horizontal Shift
input double InpKeltnerMultiplier = 1.0; // Distance multiplier
#include
#include
void main() {
IndicatorDigits(Digits+1);
MT4Scope* scope = manager.destroyOnExit(new MT4Scope());
manager.add(new Keltner(scope, InpKeltnerPeriod, InpKeltnerShift, InpKeltnerMultiplier));
}you would ask for the two includes, too. They contain other includes, so you wanted probably all of them in the end. I have no energy to pack it for you just for making you happy to check it.
Everything is a little programming trick if you think this way. If little programming tricks have no purposes, you should avoid half of this forum.
I have code distributed among many files. If I printed out the main file content:
#property indicator_buffers 3
#property indicator_color1 LightSeaGreen
#property indicator_color2 LightSeaGreen
#property indicator_color3 LightSeaGreen
//--- indicator parameters
input int InpKeltnerPeriod = 10; // Period to count
input int InpKeltnerShift = 0; // Horizontal Shift
input double InpKeltnerMultiplier = 1.0; // Distance multiplier
#include
#include
void main() {
IndicatorDigits(Digits+1);
MT4Scope* scope = manager.destroyOnExit(new MT4Scope());
manager.add(new Keltner(scope, InpKeltnerPeriod, InpKeltnerShift, InpKeltnerMultiplier));
}you would ask for the two includes, too. They contain other includes, so you wanted probably all of them in the end. I have no energy to pack it for you just for making you happy to check it.
99.99% of code are programing tricks (if the code is good)
The assumption that it is simple to find them out just because they are simple (when they are solved) is as far from the truth as it can be - sometimes the shortest "programing tricks" are the hardest to find out
So, let us keep finding out "programing tricks" as it is obvious that the platform coders are lacking it
_________________________
PS: nice flow charts ovo. But then you know too, that someone will also tell that it is simple. Keep up the good work. In a flood of "coders" that are, on some sites, always doing one and only thing : the "compile it with build 509 to work with new metatrader 4" type of solutions, it is a refreshment to see a coder like you willing to share his work with others
End-pointed version of SSA is particularly heavy on CPU when applied to offline charts. Here is a version that works OK on offline charts too : corridor_ssa_normalized_end-pointed_amp_alerts_2_ols.ex4
NonLag ma optimized for offline charts (and as it is told already, it works correctly on regular charts too) : nonlagma_nrp_ols.ex4
SyncScroll
Another little trick.
Indicator binds scrolling of multiple charts.
This one is not "optimized" old indicator for offline charts, but my new indicator that may be used for synchronized scrolling of any charts.
SyncScroll.ex4
I am appending the main file source in case someone needs to check it or whatever.
#property icon "\\Images\\avatar64.ico";
#property version "100.000"
#property copyright "Ovo (c) 2014"
#property link "http://forex.ovo.cz"
#property indicator_chart_window
#property description "Synchronizes scrolling ofmultiple charts."
#property description "Click on a chart which should control others, then scroll it by F12, mouse or keyboard. Other charts will follow."
#property description "May be used with any timeframes and charts, including mixed symbols and offline charts."
#define CHART_EVENT_ENABLE
#include
input int CHANNEL = 0; // Identify synchronized chart group
bool MASTER = false;
#define VERTICAL_BAR "SyncMasterBar"
void main() {
manager.add(new ChartMoveListener());
manager.add(new SyncRequestListener());
manager.add(new MasterSwitchListener());
}
class ChartMoveListener : public MT4ChartListener {
int recentBar;
public:
void run (MT4ChartEvent* event) {
// set to master mode only if something different than "chart change" gets fired
if(!MASTER && !event.isChartChange()) {
MASTER = true;
MT4CustomEvent e;
e.setCustomType(EVENT_SYNCMASTER_BROADCAST);
e.setDoubleNumber(CHANNEL);
broadcast(e);
}
// return if chart is not in master mode
if (!MASTER || !event.isChartChange()) {
return;
}
int firstBarIndex = (int)ChartGetInteger(0,CHART_FIRST_VISIBLE_BAR);
// do not re-calculate
if (firstBarIndex>0 && recentBar != firstBarIndex) {
// calculate central bar
recentBar = firstBarIndex;
int barsOnChart = (int)ChartGetInteger(0,CHART_WIDTH_IN_BARS);
int focusedIndex = firstBarIndex - (barsOnChart / 2);
focusedIndex = min(max(focusedIndex,0), firstBarIndex);
datetime focusedDate = Time[focusedIndex];
// display central vertical line
ObjectCreate(0,VERTICAL_BAR, OBJ_VLINE, 0, 0, 0);
ObjectSet(VERTICAL_BAR, OBJPROP_TIME1, focusedDate);
ObjectSet(VERTICAL_BAR, OBJPROP_COLOR, clrRed);
// fire central bar position to other charts
MT4CustomEvent e;
e.setCustomType(EVENT_SYNCCHART_BROADCAST);
e.setLongNumber(focusedDate);
e.setStringValue(_Symbol);
e.setDoubleNumber(CHANNEL);
broadcast(e);
}
}
// broadcast event
void broadcast(MT4CustomEvent& e ) {
for (long newChartId = ChartFirst();newChartId > 0;newChartId = ChartNext(newChartId)) {
// skip current chart
if (newChartId == ChartID()) {
TRACE("skipping home chart " + ChartID());
continue;
}
e.fireEvent(newChartId);
}
}
};
// Synchronzes central bar to event data
class SyncRequestListener:public MT4CustomListener {
long lastTime;
void run(MT4CustomEvent *event) {
if (!MASTER && event.getCustomType() == EVENT_SYNCCHART_BROADCAST && event.getDoubleNumber() == CHANNEL && event.getLongNumber() != lastTime) {
TRACE("incomming event");
lastTime = event.getLongNumber();
int barsOnChart = (int)ChartGetInteger(0,CHART_WIDTH_IN_BARS);
datetime focusedDate = (datetime)event.getLongNumber();
int focusedIndex = iBarShift(NULL, 0, focusedDate);
int firstBarIndex = focusedIndex + (barsOnChart/2);
firstBarIndex = min(firstBarIndex, Bars-1);
//Print(firstBarIndex);
ChartSetInteger(0, CHART_AUTOSCROLL, 0);
ChartNavigate(0, CHART_BEGIN, Bars - firstBarIndex);
ObjectCreate(0,VERTICAL_BAR, OBJ_VLINE, 0, 0, 0);
ObjectSet(VERTICAL_BAR, OBJPROP_TIME1, Time[focusedIndex]);
ObjectSet(VERTICAL_BAR, OBJPROP_COLOR, clrGreen);
}
}
~SyncRequestListener() {ObjectDelete(VERTICAL_BAR);}
};
// Switches to slave mode if some other chart gets control
class MasterSwitchListener: public MT4CustomListener {
public:
void run(MT4CustomEvent* e) {
if (e.getCustomType() == EVENT_SYNCMASTER_BROADCAST && e.getDoubleNumber() == CHANNEL) {
MASTER = false;
}
}
};Guys, thanks for these tools
What is exactly the problem with offline chart this time?
They had problems before too, but what is screwed this time?
What is exactly the problem with offline chart this time? They had problems before too, but what is screwed this time?
One of the problems is that when you send it an event to refresh chart, it refreshes "thinks" that always all the data on the chart have changed, while that is not true at all. It causes CPU overload
In build 509 and earlier it used to work correctly (some built in internal functions are working wrong in new builds)
One of the problems is that when you send it an event to refresh chart, it refreshes "thinks" that always all the data on the chart have changed, while that is not true at all. It causes CPU overload In build 509 and earlier it used to work correctly (some built in internal functions are working wrong in new builds)
So, all in all, it is not a problem of offline chart but metatrader?
So, all in all, it is not a problem of offline chart but metatrader?
One way of looking at it
Simply, some built functions that are working correctly (and used to work correctly in older builds of metatrader) are not working as they used to (correctly). My guess is that since metatrader 5 never had offline charts and sine they are merging metatrader 4 and metatrader 5, what we are seeing are errors when using metatrader 5 machine on a thing that it (metatrader 5) never could do
And that would mean that we are going to wait for a long time for error corrections (I remember that iStdevOnArry() was working wrong for at least 4 years even though metatrader was notified of the error)