enterLong() and enterShort() are exiting opposites trades

Posted By: anissyo

enterLong() and enterShort() are exiting opposites trades - 03/14/21 20:11

Hello i noticed that when enterLong() is used openned short trade get's exited automatically without waiting to reach stoploss or takeprofit and the same with enterShort(), is there a way to open trades without exiting all opposite direction trades ?
ps: posting on 'blame the manual' section be cause i can't find an answer in the tutorial
Posted By: anissyo

Re: enterLong() and enterShort() are exiting opposites trades - 03/14/21 23:15

after a few hours of research i managed to understund that i need to disable hedging, but when i use hedging = 2; in the run() function i get an error, should i add hedging = 2; in another place ? in same sort of file in the directory where zorro is installed ?

any help is very appreciated, thank's in advance
Posted By: anissyo

Re: enterLong() and enterShort() are exiting opposites trades - 03/14/21 23:19

set (Hedge =2);

is the solution.
Posted By: AndrewAMD

Re: enterLong() and enterShort() are exiting opposites trades - 03/15/21 01:22

Blame the Manual is for when you believe you have found errors in the manual.

You might get quicker responses in “Starting with Zorro”. It’s for people just starting to use Zorro.
Posted By: anissyo

Re: enterLong() and enterShort() are exiting opposites trades - 03/15/21 20:37

Okay thank you, i will try the other threads but just one question, when i use set(Hedge=2) the last short and long trade are not being exited as you can see in the picture i attached
can you plz help me point the problem ?? it's very weird... it's like the stop loss and target profit just stop's working suddently

Attached picture Zorro Chart - first_strategie_EURUSD.jpg
Posted By: AndrewAMD

Re: enterLong() and enterShort() are exiting opposites trades - 03/15/21 21:09

Post your script in its entirety.
Posted By: anissyo

Re: enterLong() and enterShort() are exiting opposites trades - 03/16/21 17:55

Thank you so much, it's be cause the stoploss and takeprofit at thos two trades were 0, wich is the equivalent of no stop loss and no take profit so the trades were just kept open untill the backtest ended
Posted By: anissyo

Re: enterLong() and enterShort() are exiting opposites trades - 03/16/21 22:20

Hello Andrew again,
i just need you to point me to the right direction please, newbieness suck's lol...
i am 99% sure that my code is correct be cause under the same conditions i have enterLong(0); another variable is set to 1 each time the conditions are met to enter the market, i can see in the ploted graph of this variable that the value change's to 1 but the trade is not oppened in approximatively 30% of the times, i think it's be cause of the default trading time set by zorro trader but when i try to change the default trading time by adding " StartMarket = EndMarket = 0; " to disable market closing and trade 24h/24h the market i see unfortunately nothing change, thank you
© 2024 lite-C Forums