Hi. Can the keyword SetStopLoss in Stop Loss default Signal be modified and used with highs and lows instead of dollar amount? Like stop at high of bar number 5 or stop at lowest of last 2 bars? Is price recognized by this keyword?
Thanks.
SetStopLoss with highs and lows.
-
- Posts: 47
- Joined: 03 Jan 2023
- Been thanked: 3 times
Re: SetStopLoss with highs and lows.
I think you can create a variable and just reference it with stop. Someone will probably correct this but off top of head something like
Code: Select all
Input: Length(2);
Var: stophigh(0);
stophigh = Highest(High, Length);
If marketposition =-1 then begin
buytocover next bar at stophigh stop;
end;
Re: SetStopLoss with highs and lows.
Thanks. This works if you wait for a bar after entry to set the stop. I want it done right after entry on same bar. So have to use SetStopLoss which can only be in dollars or points I was told.I think you can create a variable and just reference it with stop. Someone will probably correct this but off top of head something like
Code: Select all
Input: Length(2); Var: stophigh(0); stophigh = Highest(High, Length); If marketposition =-1 then begin buytocover next bar at stophigh stop; end;
Thanks.
-
- Posts: 47
- Joined: 03 Jan 2023
- Been thanked: 3 times
Re: SetStopLoss with highs and lows.
hmm I am new myself to PL , id also like to know the solution. Perhaps you can use 2 different data sources in code with different time frames. What bar time frame are you using? If it was daily then perhaps you could set up a data2 with smaller time frame so it would occur within the daily bar?
Re: SetStopLoss with highs and lows.
I am using mostly 5 and 15 minute charts. Does not make sense to use a second data series if I am trading on one time frame. One way to do that would be to turn on IOG that would really slow down your program depending on how many charts you have open. Anyone from MC see these posts to offer any help??hmm I am new myself to PL , id also like to know the solution. Perhaps you can use 2 different data sources in code with different time frames. What bar time frame are you using? If it was daily then perhaps you could set up a data2 with smaller time frame so it would occur within the daily bar?
- Svetlana MultiCharts
- Posts: 645
- Joined: 19 Oct 2017
- Has thanked: 3 times
- Been thanked: 163 times
Re: SetStopLoss with highs and lows.
Hi Eric1704,
You can use regular stop orders for your needs.
No, it cannot. Stop Loss is always calculated as an offset from the entry price.Can the keyword SetStopLoss in Stop Loss default Signal be modified and used with highs and lows instead of dollar amount?
You can use regular stop orders for your needs.
Re: SetStopLoss with highs and lows.
Thanks. I do not want to wait for a bar to close to place an order. That is why I am using SetStopLoss for stop right away upon entry bar itself.Hi Eric1704,
No, it cannot. Stop Loss is always calculated as an offset from the entry price.Can the keyword SetStopLoss in Stop Loss default Signal be modified and used with highs and lows instead of dollar amount?
You can use regular stop orders for your needs.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: SetStopLoss with highs and lows.
If you want to trade at the end of the bar, but set your stop intra-bar, you can do the following:
1. Enable IOG IntrabarOrderGeneration.
2. On your trading logic, add BARSTATUS=2.
1. Enable IOG IntrabarOrderGeneration.
2. On your trading logic, add BARSTATUS=2.
Re: SetStopLoss with highs and lows.
Thanks TJ. Does setting IOG to ON slow down MC in any way? Especially with an instrument like NQ.If you want to trade at the end of the bar, but set your stop intra-bar, you can do the following:
1. Enable IOG IntrabarOrderGeneration.
2. On your trading logic, add BARSTATUS=2.
Thanks.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: SetStopLoss with highs and lows.
No, not that I can notice.Thanks TJ. Does setting IOG to ON slow down MC in any way? Especially with an instrument like NQ.If you want to trade at the end of the bar, but set your stop intra-bar, you can do the following:
1. Enable IOG IntrabarOrderGeneration.
2. On your trading logic, add BARSTATUS=2.
Thanks.
At any rate, with today's computer prices, you can always get a more powerful computer, for very little money.
Re: SetStopLoss with highs and lows.
Thanks TJ. I have seen like half a second to a secong lag between time a bar closes and order generation. Maybe upgrade the VPS?No, not that I can notice.Thanks TJ. Does setting IOG to ON slow down MC in any way? Especially with an instrument like NQ.If you want to trade at the end of the bar, but set your stop intra-bar, you can do the following:
1. Enable IOG IntrabarOrderGeneration.
2. On your trading logic, add BARSTATUS=2.
Thanks.
At any rate, with today's computer prices, you can always get a more powerful computer, for very little money.
- TJ
- Posts: 7743
- Joined: 29 Aug 2006
- Location: Global Citizen
- Has thanked: 1033 times
- Been thanked: 2222 times
Re: SetStopLoss with highs and lows.
Theoretically, it should not make a difference.Thanks TJ. I have seen like half a second to a secong lag between time a bar closes and order generation. Maybe upgrade the VPS?
Your need is to evaluate the stop position at every tick. Whether it is done through the built-in stoploss or through coding, MC will have to do the same calculation.
Re: SetStopLoss with highs and lows.
What I have seen with MC is the lag of a second or so after bar close to see entry order pop up. In NT 8 it is almost instantaneous. No lag.Theoretically, it should not make a difference.Thanks TJ. I have seen like half a second to a secong lag between time a bar closes and order generation. Maybe upgrade the VPS?
Your need is to evaluate the stop position at every tick. Whether it is done through the built-in stoploss or through coding, MC will have to do the same calculation.