![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Look at the variable names. No human coder would use this type of naming because it makes it hard to read your code.
You would be surprised...loool
You would be surprised...loool
This exactly what I thought and I am so frustrated now to realize that the code I had been working with wasnt intentionally poorly written. I am going to ask for the REAL source.
Basically I am trying to make a local variable global if that makes sense...
Not really... if you want a variable to retain its state between calls then you need to make it static. If you need to pass a variable to function and have that function modify it in-place then you need to pass it by reference. If you just need to the second function to know a significant value for operation then pass it by value.
Not really... if you want a variable to retain its state between calls then you need to make it static. If you need to pass a variable to function and have that function modify it in-place then you need to pass it by reference. If you just need to the second function to know a significant value for operation then pass it by value.
Ok so say my first function is the one below (onTick) and I am trying to use the returned value of switch_function in my second function
1. first function
2. second function
How could I make sure that the value of the switch_action carries over from function 1 to function 2?
@nicholi shen
What on earth?!? This isnt decompiled code?! who deleted my code snippet?
I deleted it. Anybody with a little more than basic knowledge of coding can recognise decompiled code immediately.
Posting decompiled code is against the forum rules and doing so can get you banned.
You have been given the benefit of the doubt this time as often people who have no coding experience do not realise that the code is decompiled.
Ok so say my first function is the one below (onTick) and I am trying to use the returned value of switch_function in my second function
1. first function
2. second function
How could I make sure that the value of the switch_action carries over from function 1 to function 2?
@nicholi shen
https://www.learncpp.com/cpp-tutorial/73-passing-arguments-by-reference/
https://www.learncpp.com/cpp-tutorial/73-passing-arguments-by-reference/
Ok so this is what I did:
First function,
Second function,
doing "if(switch_action==1)" doesn't work here either. If I use "if(switch_action=1)" it will only buy. Any ideas?