Please shorten the width of your Print lines of code
Your post and code is twice the width of my screen
Makes it difficult to read, so I won't
Please shorten the width of your Print lines of code
Your post and code is twice the width of my screen
Makes it difficult to read, so I won't
Sorry,
I have no idea what you are trying to achieve
Sorry,
I have no idea what you are trying to achieve
What I want to achieve is that the indicator draws just ONE entry arrow as soon as an entry signal occurs and if there was an entry signal that it draws an
exit arrow as soon as an exit signal occurs. Like it does in the first screenshot.
BUT I want to achieve that without recalculating the whole history at every tick. And that is the problem. My code just works if I recalculate the whole
history over and over again.
What I mean is that I don't know what your code is aiming to achieve.
You wrote the code, so you can follow it, I can't. The use of non reader-friendly variable names doesn't help.
What I mean is that I don't know what your code is aiming to achieve.
You wrote the code, so you can follow it, I can't. The use of non reader-friendly variable names doesn't help.
The point is that I am trying to keep the infomation if an entry signal occured (e.g. long_position_buffer[]) in order to draw an entry arrow
only once and to draw an exit arrow only if there was an enty arrow before.
long_buffer[i] = 0; //displays entry arrows
long_ex_buffer[i] = 0; //displays exit arrows
long_position_buffer[i] = long_position_buffer[i+1]
if(long_position_buffer[i+1] == 0 && long_entry_signal == true) {long_buffer[i] = long_entry_arrow; long_position_buffer[i] = 1;}
if(long_position_buffer[i+1] ==1 && long_exit_signal == true) {long_ex_buffer[i] = long_exit_arrow; long_position_buffer[i] = 0;}
BUT this type of logic only works if I recalculate the whole history which I do not want. So I am looking for a clue how I can adopt
this logic or hint for another solution which works for my problem...
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Dear all,
I am working on an index (see code below) which should draw arrows for trading signals which are based on calculations on the enty timeframe (e.g. H4)
and on higher timeframes (e.g. D1 and W1). Under the bottom line it should draw certain arrows for different typs of entry signals and if an entry signal has
occured (where I would have entered a trade) it should then draw an arrow if the an exit signals occurs. So much for the plan but the implementation drives
me crazy meanwhile because as a non-professional programer I tried to solve it by trail and error in many ways and have no more idea although I think it is
just a small issue...
The problem is that so far I just get it working if I recalculate the whole history over and over again ("limit = Bars; //Recalc all Bars") which is quite unefficient
for 20 pairs with other indicators and EAs and which I want to avoid. See below the result as it should be:
But in terms of efficiency I recalc just the last 42 bars ("limit=MathMax(Bars-counted_bars,delta_PTF); //Recalc Number of Bars of Prime Timeframe") because
the indicator also repaints values of a higher timeframe (i.e. W1 => 10080 / 240 = 42) and then I get the result below. Have a look at the difference between
before and after the grey horizontal line which represents the 42 bars:
And if I just recalc the last bar ("limit = Bars-counted_bars; //Recalc last Bar") then it displays no exit arrows at all and it draws multiple enty signals which it
shouldn't...
So please have mercy and help me out of that my mind has become stuck meanwhile. Any help is highly appreciated...
Thanks all!
PS: Below is the code: