Hi. I'd like to have some systems where I enter via a trailing stop once my setup condition is met. Is this currently possible to do in the Simulator without needing a custom MM script?
If I need a custom money management script, can you give me the code, please?
Also, if this isn't currently do-able without a custom MM script, I'd like to propose it as a feature for a future version of QuantShare.
Hi. I may be doing something wrong, but your suggested solution doesn't appear to be working. Here are two sets of code that are the same except they should enter at different trailing stop entry values. Unfortunately, both sets of code appear to enter at the exact same price.
I also tried the code without a Buy rule, but that didn't take any positions.
// FIRST SET OF CODE
// Buy rules
stopLossValue = 2; // 3%
a = iff(Hhv(close,20), stopLossValue, 1000);
SetSimStop(_StopTrailing, _Percent, a, 0);
Rule1 = Hhv(close,20);
buy = (Rule1);
// SECOND SET OF CODE
// Buy rules
stopLossValue = 10; // 3%
a = iff(Hhv(close,20), stopLossValue, 1000);
SetSimStop(_StopTrailing, _Percent, a, 0);
Ok... thanks. I fixed that part in the code below, but I'm still getting the same entry price regardless of the stopLossValue. I'm guessing something else is wrong... can you help?
// Buy rules
stopLossValue = 15; // 3%
a = iff(Close > ref(Hhv(close,20),1), stopLossValue, 1000);
SetSimStop(_StopTrailing, _Percent, a, 0);
Rule1 = Close > ref(Hhv(close,20),1);
buy = Rule1;
In this case, your trailing stop will always be equal to "stopLossValue" since you are using the same rule than the buy rule.
On bars where "buy" is true, the value of "a" variable will be equal to "15".
Ok. So, this conversation started with my objective: ENTER on a trailing stop when my buy condition is true. My buy condition is to buy when the close > ref(hhv(close,20),1). Given that condition and my objective, what do I do to enter on a trailing stop?
We may be having a communication issue. I want to ENTER A NEW POSITION using a TRAILING STOP ENTRY. I do NOT want to activate a trailing stop EXIT after I've already entered.
When you ENTER on a trailing stop, you get a buy condition first. Then, before the position is entered, the trailing stop entry logic is activated. For example, if you have an ENTRY trailing stop of 3%, after the buy logic is triggered, the entry price will change as the instrument being bought declines. The entry price will be 3% off the lowest low (AFTER the buy / setup logic has been triggered).
My apologies if you already understand what I'm looking for, but I'm sensing from your answered we may not be on the same page. Is an ENTRY on a trailing stop (as described above) something that can be done without a custom MM script? If you need a custom MM script, can you point me to some similar MM code I can leverage?
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.