Reply

Complex order problem

4 replies

jonnywolf

Subscriber, bbp_participant, community, 25 replies.

Visit profile

11 years ago #110955

I would like to set a rule to double up on a direction of a trade.

My strategy sets up a buy stop and a sell stop at a certain time of day.

If one of the stop orders is activated and the stop loss is hit I want to double up on the opposite trade.

Currently my rules are:

If order closed this bar ( magic number) and closed p/L <0 (magic number).

Then enter at market.

However the order keeps opening when the new market order is closed. I would like to set some sort of rule that says if magic number has already run then do not enter at market until the next day when the process starts again.

Help much appreciated?

Cheers,

Jonny

0

stearno

Customer, bbp_participant, community, 379 replies.

Visit profile

11 years ago #121186

Jonny,

I don’t think I am fully understanding what you want.

 

Let me say what I think you are asking for and then you can correct me if I have it wrong.

 

Day 1, at Time X, the EA puts a buy stop at price A and a sell stop at price B.

 

During the day, Price Action triggers the buy stop and then closes at the stop loss with a loss.

 

What you want is Day 2 at Time X, when the EA puts a buy stop and sell stop, you want a Martingale approach which does double the lots compared to the day before

 

Is this correct?

 

I would suggest to follow the template that Mark provided in the Sample Stragies section.  Basically, you will have a rule for each level you want to happen and then use conditions to choose which rule occurs…If I have this wrong, feel free to clarify what you are needing or more specifics on how to do this.

 

– Stearno

0

jonnywolf

Subscriber, bbp_participant, community, 25 replies.

Visit profile

11 years ago #121192

Hello,

 

Thanks for your reply.

 

Basically its a basic martingale strategy. I have found that if the first stop order SL is hit then the opposite trade will be more successful. But you see if this happens it is a break even day. One stop order in a loss and one order in profit. SO i came up with the idea that this happens alot, so why not increase the lot size on the opposite side and it becomes more profitable.

 

So 

 

Day 1, at Time X, the EA puts a buy stop at price A and a sell stop at price B. The stop loss is the same price as the opposite stop order entry price.

During the day, Price Action triggers the buy stop and then closes at the stop loss with a loss.

Immediately as the SL is hit and the other stop order is opened it doubles up with the same trade at the market.

 

The EA works but it keeps recognizing that the first stop order has closed with a loss, but when the new doubled up trade is in profit or loss then it reopens the loop again. I need a way to say only open the trade if it hasn’t happened yet.

 

I have a close all trades function by the time the new set of trades for the next day happens but i would like to experiment with trailing the second order..

 

Its simple but i cannot seem to explain it in a simple way.

 

Thanks,

 

Jonny

0

Mark Fric

Administrator, sq-ultimate, 2 replies.

Visit profile

11 years ago #121193

Hello Johny,

 

I think  in this case you can perhaps use function like “Last order was …” or “Order Closed this bar”

to determine which order actually closed and depending on that open a double order or start from initial size.

If you’ll check the martingale strategy sample in this forum this is solved there.

 

Mark 

Mark
StrategyQuant architect

0

jonnywolf

Subscriber, bbp_participant, community, 25 replies.

Visit profile

11 years ago #121201

Ok so what worked was that i had to put an additional rule in that was orderclosedthisbar(magic number) is false to stop it from reopening the second market order.

0

Viewing 4 replies - 1 through 4 (of 4 total)