When my trading system makes a decision to buy, I want to be able to set target profit stop (limit order) and stop-loss prices based on the conditions at the time of the purchase? I haven't been able to make this work.
For example:
Buy at open Tomorrow, then sell using profit targets and stop loss:
Buy1 = (close > ref(close,1)*1.1);
Buy2 = (volume > 100000);
Buy3 = (close > 1);
buy = (Buy1) && (Buy2) && (Buy3);
ProfitTarget = ((close - ref(close,1))/ref(close,1))*close <--- I only want this evaluated when the buy trigger is made, not daily
StopLoss = ref(low,1); <--- I only want this evaluated when the buy trigger is made, not daily
SellPrice(StopLoss, ProfitTarget, -1);
When I use something similar to above, positions open, but never close. Is there a way to set specific OCO sell limit and stop orders?
Hi. . . Thanks for the reply. I'm coming back around to work on this again, and am still having trouble.
I don't want a constant, nor do I want a dynamic sell price. I want something in between the two. . . I want loss and profit stop prices calculated when entering the position, based on a formula. I want to use those same values until the position exits.
I have a similar problem like the original post. I want to set a StopLoss to the "Low" of the purchase day. This can NOT be defined by a fixed, percent or indicator rule. Because NONE of those give me the "Low" of the purchase day. Thank you for any help.
Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.