Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TedMar, AndrewAMD), 1,344 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
ExitLong() for ProfitTarget #487591
06/12/23 15:45
06/12/23 15:45
Joined: May 2023
Posts: 5
J
JMMAC Offline OP
Newbie
JMMAC  Offline OP
Newbie
J

Joined: May 2023
Posts: 5
Hi,

I want to partially exit trades at limit (Profit Target) so I save the trade information and use ExitLong() to exit.

For some reason (probably my mistake) the trade is executed not in the current bar at the price I enter but at the open of the next bar (market order).

Next is the logic to close the trade. According to the manual it should enter a limit order at the given price. What am I doing wrong?

Code
   if (tp_pos == LONG)
   {
      if (priceH(0) >= tp_value)
      {
         exitLong("", tp_value, 0);
         tp_pos = NEUTRAL;
      }
   }


Thank you,
Jaime

Re: ExitLong() for ProfitTarget [Re: JMMAC] #487601
06/13/23 18:02
06/13/23 18:02
Joined: May 2023
Posts: 5
J
JMMAC Offline OP
Newbie
JMMAC  Offline OP
Newbie
J

Joined: May 2023
Posts: 5
Reading the manual more carefully, for a limit order, "Price" must be negative. That part is fixed.

But in the chart the order appears closed in the wrong bar as can be seen in the picture. The close price is correct but not the bar. Should I report this? How?

Attached Files exitLong.png

Moderated by  Petra 

Powered by UBB.threads™ PHP Forum Software 7.7.1