Does anybody know how to set a stop loss and profit target when back testing a signal on marketdelta? cannot get the coding right and market delta forward you to someone meant to help' who charges 500 dollars on down payment, and 100 dollars per hour after that. Any replies would be greatly appreciated. Thank you!
There are a few ways to do this. But you have a token, ENTRY, which, after entering a trade, tells you the price of the entry. So you can have a target rule/signal...with action SELL...with syntax...
HI >= ENTRY + 2.50 AND SET(V#10, ENTRY + 2.50)
and set the price of the rule to V#10...
on the stop side....
LO <= ENTRY - 2.50 AND SET(V#10, ENTRY - 2.50)
and again, set rule price to V#10.
You'll want to adjust the 2.50 to whatever your target/stop is.
I would recommend added your exit rules ABOVE your entry rules in the rule order (can adjust after laying them down). Important so it doesn't get in and out on same bar.
Now let's say your initial trade buys 100 contracts, and you want multiple targets. You'll need to manage that with the POS_SIZE token which tells you the current size of your position (positive for long, negative for short). So if you wanted one target at 2.50 (take off half) and another at 5.00. You'd use these two rules, both with action SELL...
HI >= ENTRY + 2.50 AND POS_SIZE = 100 AND SET(V#10, ENTRY + 2.50)
HI >= ENTRY + 5.00 AND POS_SIZE = 50 AND SET(V#10, ENTRY + 5.00)
Both rules would use a price of V#10, and the rule would have a size of 50, and the 2nd rule could have a quantity of 50 or even "ALL". If you enter "ALL" as the rule quantity, it will just get you out of whatever position is left regardless of how much is left.
Hope this helps. I'm going to try to attach a trading system definition that shows a target at 5.00 and two stops at 2.50 and 5.00. Import this and take a look.