How do I call a variable from init() into my code?

 

I want to find a ticket number once in my Init sequence and increment it through the rest of my code when I place orders.

Basically I place an order. If there are other orders, I close the order. And decrement that ticket number until the symbol equals "EURUSD". Other wise I leave the order open and it is my last order.

That ticket no is LastEUR_Order. Can I end my init() with the following?:

return(LastEUR_Order);

If I want to print the string, it says that the variable needs to be initialised and otherwise is equal to 0.

Should I maybe write it to a .CSV file?

 

Ticket number is assigned by Dealer. Your idea does not sound plausible.

StrategyTester assigns sequential Ticket numbers, you will not necessarily see that on demo or live trading.