Posted By: WaltT
for(current_trades) vs for(open_trades) - 08/20/22 17:58
What exactly is the difference between ...
for(current_trades)
and
for(open_trades)
?
As far as I can see, they pretty much do the same things. They both cycle through the list of open and pending trades starting with the first trade. Where is the difference?
Posted By: AndrewAMD
Re: for(current_trades) vs for(open_trades) - 08/20/22 18:02
Posted By: WaltT
Re: for(current_trades) vs for(open_trades) - 08/20/22 18:47
Okay, so ...
for(current_trades) loops through just the current asset and algo,
while
for(open_trades) loops through all assets and algo, not just current trades.
So what makes a trade open but not necessarily current? What would be an example of an open trade that wasn't current?
Posted By: AndrewAMD
Re: for(current_trades) vs for(open_trades) - 08/20/22 18:55
You just explained the entire difference between the two. current is for the current asset-algo combination. That is all it means.
Posted By: WaltT
Re: for(current_trades) vs for(open_trades) - 08/20/22 18:58
Thanks, but I still don't understand what the difference is between current and open. To me, they seem to mean the same thing. I can't imagine a situation where an open trade wouldn't also be a current trade, and vice-versa. It sounds like current trades are a subset of open trades, but I can't imagine what might be an example of a non-current, open trade.
Posted By: AndrewAMD
Re: for(current_trades) vs for(open_trades) - 08/20/22 19:01
Have you completed the workshop from beginning to end? If so, you might remember workshop 6:
https://zorro-project.com/manual/en/tutorial_kelly.htmHere, two different assets and two algorithms are used. Now, you can select any asset and algo combination in your script and isolate those related trades using current_assets, because it is in reference to the current asset and algo combination.
If you did not complete the workshop, I highly recommend it.
Posted By: AndrewAMD
Re: for(current_trades) vs for(open_trades) - 08/20/22 19:07
In other words, all current trades are open trades, but only some open trades are current trades.
Posted By: WaltT
Re: for(current_trades) vs for(open_trades) - 08/20/22 19:45
That workshop page has some interesting stuff on it, but there are no for loops in the code at all. Nor are there any references on the page to for loops of any kind. So I don't see how that workshop clarifies the difference between "current" and "open" for loops.
I already inferred that current trades in this context appear to be a subset of open trades, so your confirmation of that inference is helpful. Thank you for that.
I also infer that "current" in this context refers to what asset or algo the script is trying to look at specifically. So for example, if a script focuses its attention on all open trades in EURUSD, the current trades would be those EURUSD open trades, while non-current trades would be open trades in other investment instruments besides EURUSD.
However, I don't see anything in the two functions as described in the manual that tell me how exactly to instruct the script to differentiate between them by focusing on EURUSD. Maybe the functions draw an inference from the context of the script in some way?
So far, it feels more like "magic" than programming. Since magic is technology that isn't fully understood, I'm trying to understand it.
Posted By: AndrewAMD
Re: for(current_trades) vs for(open_trades) - 08/20/22 20:16
I really don't know what you're confused about. You call asset("ASSETNAME"), then algo("ALGONAME"), then for(current_assets), and inside that loop will be trades related to the "ASSETNAME"-"ALGONAME" combination. Then you can access the trade variables listed here:
https://zorro-project.com/manual/en/trade.htmAny questions?
Posted By: WaltT
Re: for(current_trades) vs for(open_trades) - 08/20/22 20:40
Okay, so you just confirmed my suspicion that for(current_trades) works contextually, based upon the asset and algo calls. Thank you for that.
I'm guessing also that if I used for(open_trades) instead of for(current_trades), it wouldn't pay any attention to the context the script established by calling asset and algo.
Thanks for clarifying.