Sending multiple conditional orders  [SOLVED]

Questions about MultiCharts and user contributed studies.
bondstrader
Posts: 7
Joined: 26 Sep 2014
Has thanked: 2 times

Sending multiple conditional orders

Postby bondstrader » 13 Oct 2014

Again, a basic query. For some reason, Im not able to get it to execute.

What Im trying to do is trigger an order based on certain conditions (condition1 and condition2).
Once that executes, I want to check if the same conditions hold true at 10pm. If so, I want to trigger another order of the same quantity.
The first order triggers ok in in backtesting, but the second one doesnt. Any help on what Im missing?

Code: Select all

if marketposition = 0 and condition2 = true and condition3 = true then begin
Buy ("Open-L1") 1 contracts Next bar at Market;
end;

if marketposition = 1 and currentcontracts = 1 and time = 2200 and condition2 = true and condition3 = true then begin
Buy ("Open-L2") 1 contracts Next bar at Market;
end;

User avatar
Andrew MultiCharts
Posts: 1587
Joined: 11 Oct 2011
Has thanked: 931 times
Been thanked: 559 times

Re: Sending multiple conditional orders

Postby Andrew MultiCharts » 13 Oct 2014

Hello bondstrader,

What is the chart type and chart resolution?

bondstrader
Posts: 7
Joined: 26 Sep 2014
Has thanked: 2 times

Re: Sending multiple conditional orders

Postby bondstrader » 13 Oct 2014

Hi Andrew

Im using multiple timeframes. The execution takes place on the 5min chart, while data is derived from the daily and weekly charts.
As I see the 5 min chart, the first order triggers at 20:05 when the conditions turn true. After that, the conditions remain true for more than 24 hours, and according to my expectation, it should re-trigger another order at 22:00, but that doesnt happen. I even removed the conditions for the second order, but nothing. If I trigger an exit order, then the signal has no problems triggering new orders.....but for some reason, it doesnt add additional lots. Seems to be a net position issue, but Im not sure how to resolve it.

User avatar
furytrader
Posts: 354
Joined: 30 Jul 2010
Location: Chicago, IL
Has thanked: 155 times
Been thanked: 217 times

Re: Sending multiple conditional orders  [SOLVED]

Postby furytrader » 13 Oct 2014

I have a suspicion what the problem might be but I can't tell without seeing the rest of the code.

If I were you, I would enter the following line to help you debug it:

Code: Select all

Print(Date," ", Time," Market Position = ",MarketPosition, " Current Contracts = ", currentContracts," Condition2 = ", condition2, " Condition3 = ", Condition3);
This will show you the value of each of these variables for each bar, so it may help you to better determine which part is going astray.

** Also, I assume you have checked the system property called "Allow up to X entry orders in the same direction as the currently held position" .. ?

bondstrader
Posts: 7
Joined: 26 Sep 2014
Has thanked: 2 times

Re: Sending multiple conditional orders

Postby bondstrader » 13 Oct 2014

** Also, I assume you have checked the system property called "Allow up to X entry orders in the same direction as the currently held position" .. ?
You assumed wrong! Thank you for helping me right before I was about to pull out my hair. It was a basic issue, but took an experienced eye to spot it.
Thanks again. Its working perfectly now!


Return to “MultiCharts”