Say I'm trying to write an algo with four different scenarios; each with its own entry, profit target and stop loss order settings.

pseudocode:

if condition1:
- go long immediately at market, set a stop loss order SLM points below entry price, set a profit take order PTM points above entry price

if condition 2:
- as above, but go short instead of long

if condition 3:

- submit a resting limit buy order at the current Ask price, set a stop loss order SLL points below entry price, set a profit take order PTL points above entry price

if condition 4:
- as above, but enter with a resting limit sell at the current Bid price


All the above are mutually exclusive. My reading of the relevant manual page (https://manual.zorro-project.com/buylong.htm) made me think I need to pass the static parameters directly to enterShort() or enterLong() when they're called but I'm having some issues with how I've done it below.

1) No trades seem to enter at market (have already determined condtion1 and condition2 are triggering correctly).
2) Logs seem to suggest stops are being trailed when I don't want them to be (log snippet below script)

Can anyone point me in the right direction? Should I be using a trade management function for this, or is the below roughly correct (with wrong syntax)?

Code

	// => Enter at market
	if (condition1) // Long Entry
	{
		enterLong(_lots,0,SLM,PTM);		
	}	
									
	else if (condition2) // Short Entry
	{

		enterShort(_lots,0,SLM,PTM);		
	}											
									
        // => Passive entry						
	else if (condition3)
	{

		enterLong(_lots,-_ticks,SLL,PTL);		
	}			
			
	else if (condition4) 
	{
		enterShort(_lots,-_ticks,SLL,PTL);	
	}
	
	



Trade logs - stops being trailed

[3269: Fri 14-01-03 15:30] -880 0 33/34 (163.07)
Enter 500 Long SPY Entry -0.025000 Stop 0.75000 TP 0.050000 at 15:30:00
(SPY::L) Long 500@163.04 Entry limit
(SPY::L) Entry limit 163.04 hit by 163.03 at 15:30:00
[SPY::L27033] Long 500@163.08 Risk 396 p at 15:30:00

[3270: Fri 14-01-03 15:31] -880 -18.63 33/35 (163.05)
Enter 500 Long SPY Entry -0.025000 Stop 0.75000 TP 0.050000 at 15:31:00
[SPY::L] Skipped (Max = 1)

[3271: Fri 14-01-03 15:32] -880 +1.36 34/34 (163.09)
Enter 500 Long SPY Entry -0.025000 Stop 0.75000 TP 0.050000 at 15:32:00
[SPY::L] Skipped (Max = 1)
[SPY::L27033] Trail 500@163.08 Stop 162.34 at 15:32:00

[3272: Fri 14-01-03 15:33] -880 +11.37 34/34 (163.11)
Enter 500 Long SPY Entry -0.025000 Stop 0.75000 TP 0.050000 at 15:33:00
[SPY::L] Skipped (Max = 1)
[SPY::L27033] Trail 500@163.08 Stop 162.36 at 15:33:00


Code