I currently have 2 studies. One that I load on a 15 min chart and it watches for buys. The other I load on a 15 min chart and it watches for sells. I tried to combine them and get too confused with variables, if else statements...etc. However, I found that if I load both on the same 15 min chart it works. I want to be able to load them as one so I can total profits and losses from both buys and sells. Is there an easy way to load a "parent" efs that loads both of these and lets me use the variables from each?
Announcement
Collapse
No announcement yet.
Combining 2 efs
Collapse
X
-
junkyforjc
Modify the "Buy" efs to return a 1 when it buys and 0 when it is flat and modify the "Sell" efs to return -1 when it sells and 0 when flat.
Then create a third efs and use call() or callFunction() to retrieve those signals (1, 0 or -1) from the other two efs(s) and at the same time pass back the variables to be used.
Try running a Search for "erilein" as the UserName and you should find at least two threads showing some examples of the above.
Alex
-
Would each of the efs' be called on newbar() and therefore do the same as loading them both on the same chart. Or do you have to encapsulate the call() for both inside a loop for newbar()?
Can you return any variable you want from the 2 efs or do they need to be declared global or such?In His Grip
Comment
-
junkyforjc
They would be called on every tick - just as if you had those same efs(s) loaded directly in the chart - unless you enclose the call() or callFunction() in a BARSTATE_NEWBAR condition.
As to your second question you would be returning whatever is in the return array of the called efs(s)
Alex
Comment
Comment