[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 334
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
Boris, if you comment out one of the conditions in int GetGeneralSignal(), the opening is clear.
I have tracked it down. The flag does not change its value when the profitability of currently open orders is in minus. Here is the rewritten function that should set the short and long flags to false, i.e. prohibit opening a position if there are minus orders:
The calling function is this:
Maybe the conditions are more suitable for the bai? Indeed, only sells are opened today because of very weak euro decline, but still something is better than nothing!
No. The signal is written in the int function GetGeneralSignal() and it works clearly. The signal is primitive, I took it just for the test. If PCI has crossed the upper border - buy, and if the lower one - sell. I do not use indices myself, but I decided to check this only for an experiment.
So there you go. Without flags, everything works perfectly. But it is not so with flags. When theint FindOrders(bool&long,bool&short) function contains an order of the given type and its profit is below zero, my function, according to the reference to function GetGeneralSignal(), must pass false value to a certain flag but in fact the flags always show true:
I can see it in the printer, but it's not clear why the flag doesn't change.
By the way, I showed the profitability of orders in the print:
And in the print the value of the flags, this is what is shown:
I.e. it is clear that when the profitability is below zero, the corresponding flag should be set to false but this does not happen... Everything seems to be elementary, but something is not going on.
No. There is a signal in the int GetGeneralSignal() function that works well. The signal is primitive, I took it just for the test. If PCI has crossed the upper border - buy, and if the lower one - sell. I do not use indices myself, but I decided to check this only for an experiment.
So there you go. Without flags, everything works perfectly. But it is not so with flags. When theint FindOrders(bool&long,bool&short) function contains an order of the given type and its profit is below zero, my function, according to the reference to function GetGeneralSignal(), must pass false value to a certain flag but the flags always contain true:
I see it in the print, but I do not understand why the flag does not change.
I can see it in the print, but why the flag doesn't change is not clear.Corrected the typo.
Here's a screenshot:
You can see, on the chart, that the bai is minus and the flag = TRU anyway.
I feel sorry for you! I'll write you how it will work without loops, which are slowed down by functions! Here's your code, but what do I change it into!
This scheme is free of cramps and works instantly! Do away with unnecessary functions! You can find ExistPositions() function in Useful Functions of Dear Kim!I feel sorry for you! I'll write you how it will work without loops, which are slowed down by functions! Here's your code, but what do I change it into!
This scheme is easy and works instantly! Do away with unnecessary functions! You can find ExistPositions() function in Useful Functions of Kim!Boris, theExistPositions function hasthe same loop, only it has more unnecessary checks, so it won't be sluggish along the way. Your logic is clear to me, but the reason of inoperability of the previous version wasn't disclosed, which is strange :)
You also use these flags:
And I was demonstrating that they don't return correctly.
So again, if the profitL and profitS variables will be present in this function then the flags are not needed.
That's how it turned out:
Again, it's not opening on signal, it's opening on whatever.
changed it to...
Nowcloselevelis not modifiedwhen profit increases...
I've already figured it out.
Boris, theExistPositions function has the sameloop, but there are more unnecessary checks, so it won't be sluggish along the way. Your logic is clear to me, but the reason of inoperability of the previous version wasn't disclosed, which is strange :)
You are also using these flags:
And I have demonstrated that they are not correctly returned.
So again, if the profitL and profitS variables will be present in this function, then the flags are not needed.
That's how it worked out:
Again it opens not by signal, but by whatever.