Indicator Programming Question - page 2

 
xx3xxx:
hiya Kalenzo

wanna to ask you a question in MQ4 -- indicator -- looping

but I am not sure my concept is correct [ just like in physics, people thought the positive will move toward the negative, but we know actually electron are moving in the direction toward positive pole ]

for almost every indicator, we loop for i = 0 (current bar) or 1 (closed bar) to 2000

what will be the effect if I change the loop to >> for i= 2000 to 1 -- step -1

In most cases it doesn't matter in which way you are going through loop.

You can also use other loop like "while" instead "for" but "for" loop is more popular and faster.

for(i = 0;i=0;i--)

It works in the same way, just the loop is going backward or forward.

The problem comes when you are doing shift with - sign.

For example if you will write like this:

if(Close > Close) {something} then it will work good.

If you will write like this:

if(Close > Close) then you need to stop looping when i-1 == 0. If you will be moving loop forward to 0 then each bar between i -1 = 0 and 0 will be repainted. In this case it will be only one bar, but if we will take exmaple from super signals indicator then it will be 12 bars. So it's not about which loop you will use or in which way you will be moving. It's the compare logic problem.

 

then

will it be better indicator ? if we do it this way

my concept (could be wrong) is that, we use an algorithms

if we apply via recent candle to oldest candles

-- it just explain the recent event <-- overfitting to recent candle first, so by default, the chart will look too perfect

-- however, if we apply from the oldest candles to the latest candle (despite the other variable - array that take an account of a cluster of candles)

we could tell whether an algorithms is correct or not -- i.e. we could say an indicator is USEFUL for trading or useless instantly

-- the indicator that I enjoy is predictive type of indicator

show you 2 example here -- i.e. these really predict

LEFT yellow one, pastel blue and pastel pink line BOTH appear, we should stay sideline [ i.e. if only one base line appear, we bet for that direction, i.e. pink could disappear, while blue line remains ]

RIGHT pale blue one, with a big triangle pointing

if we trade down when the destination price appear, we should win some as long as the trend sustain for 0.5 to 2 days

actually, I know it is an abstract question == hard for you to answer without any indicator given

let's say over this weekend

you install 2nd copy of MT4 -- better in a different partition drive, say E drive

change all your favorite templates, all those indicator counting 500 to 1 , 500 499 498 197 .. ...

then compare the 2 templates and show us [ 1 to 2000] vs [2000 to 1]

since all the indicator will be save as the same name

so you just delete E drive afterward -- the test complete -- please let me know the result pls

I did simple OHLC programming and sometime MA type, so I got this idea for ages, but never implement it

[ as I thought, How can every programmers wrong all these time, and I would be the ONE to see something that is so obviously wrong]

just like US economic problem with housing default, local govt don't have enough jobs

why not just move dept one by one to the outskirt of the city, and rebuild those dept building

this way, new transport network be built, local civil servant buy a new house in the outskirt of town, and so many problems will be resolved all-in-one in 5 to 8 years. -- pls comment on this proposal too