Stop-Loss on entry date

Discussions about the testing and simulation of mechanical trading systems using historical data and other methods. Trading Blox Customers should post Trading Blox specific questions in the Customer Support forum.
Post Reply
kianti
Roundtable Knight
Roundtable Knight
Posts: 335
Joined: Fri May 02, 2003 6:10 am
Location: Florence - Italy

Stop-Loss on entry date

Post by kianti »

I'm testing Trading Blox and I have a few days to end of trial.
No need to say I'm very happy so far and it looks like I'll have to break my piggy-bank :D :lol: :D

I managed to write some code and I'm aware that it takes time to become fluent. I wrote for stops:

Code: Select all

stopPrice = instrument.unitEntryFill[1] + sl
instrument.SetExitStop( stopPrice )
broker.ExitUnitOnStop(1,stopPrice)
and stops are executed the next day. Is there a way to have stops executed on entry date?

Thanks in advance for any help to all Blox Master and
best regards, as ever
Tim Arnold
Site Admin
Site Admin
Posts: 9015
Joined: Tue Apr 06, 2004 1:41 pm
Location: Boston, MA
Contact:

Post by Tim Arnold »

Is there a way to have stops executed on entry date?
When you place your entry, you can indicate the entry day stop as well such as:

Code: Select all

broker.EnterLongOnOpen( protectiveStopPrice )
And if you want to adjust this stop price on the entry day, based on the fill price as an example, then you could put the following in the Can Fill Order script:

Code: Select all

stopPrice = order.fillPrice + s1
order.SetStopPrice( stopPrice )
If you set the Unit stop in the Entry Order Filled script, or in the Exit order filled script, it will be available for the next day. The Can Fill Order script is the last scripts to run before the order is actually filled and the entry day protective stop checked.

You can also loop over all the orders in the Before Order Execution script if you need to do more complex processing before the orders are submitted.
Post Reply