i'm Long to signal...
I want to fixed Stop loss (in price) and Take Profit (in price)
if (MarketPosition=1) then begin
sell next bar (entryprice(0)-averagetruerange(ran)/portionSL) stop; //stop loss
but i now i set take profit.....it hide the stop loss..
how i set Stop Loss and Take Profit togeter? thanks
can give me a link of example to signal...
Stop loss and Take Profit....Code
- Anna MultiCharts
- Posts: 560
- Joined: 14 Jul 2017
- Has thanked: 42 times
- Been thanked: 141 times
Re: Stop loss and Take Profit....Code
Hello, shivax!
Please, try to use the pre-built Stop Loss and Profit Target signals as part of your strategy or refer to their script as reference. You can view a study’s script by clicking on the “Open Script” button in the Format Objects window or by double-clicking on a study in the Navigator section in PowerLanguage Editor.
Please, try to use the pre-built Stop Loss and Profit Target signals as part of your strategy or refer to their script as reference. You can view a study’s script by clicking on the “Open Script” button in the Format Objects window or by double-clicking on a study in the Navigator section in PowerLanguage Editor.
Re: Stop loss and Take Profit....Code
I see you example but i don't want to take profit and stop with Amount...
I want to use stop loss and profit target if the price goes below or above a certain level
I can write :
if (MarketPosition=1) then begin
sell next bar (entryprice(0)-averagetruerange(ran)/portionSL) stop; //stop loss
But if i want also to code the exit Profit....how i can i code it? ( i want code Profit And Target togheter)
I want to use stop loss and profit target if the price goes below or above a certain level
I can write :
if (MarketPosition=1) then begin
sell next bar (entryprice(0)-averagetruerange(ran)/portionSL) stop; //stop loss
But if i want also to code the exit Profit....how i can i code it? ( i want code Profit And Target togheter)
- Anna MultiCharts
- Posts: 560
- Joined: 14 Jul 2017
- Has thanked: 42 times
- Been thanked: 141 times
Re: Stop loss and Take Profit....Code
shivax,
it is possible to set both commands in the strategy’s code. You can try using such keywords as SetStopLoss_pt and SetProfitTarget_pt that will allow specifying the difference from the current price in ticks, not dollars. For more information, please, refer to the following pages:
https://www.multicharts.com/trading-sof ... tTarget_pt
https://www.multicharts.com/trading-sof ... topLoss_pt
To code an exit Profit you can try to modify the code you gave as example: change stop to limit and minus to plus.
Please, specify what you understand under “Profit And Target togheter”.
it is possible to set both commands in the strategy’s code. You can try using such keywords as SetStopLoss_pt and SetProfitTarget_pt that will allow specifying the difference from the current price in ticks, not dollars. For more information, please, refer to the following pages:
https://www.multicharts.com/trading-sof ... tTarget_pt
https://www.multicharts.com/trading-sof ... topLoss_pt
To code an exit Profit you can try to modify the code you gave as example: change stop to limit and minus to plus.
Please, specify what you understand under “Profit And Target togheter”.
Re: Stop loss and Take Profit....Code
Please, specify what you understand under “Profit And Target togheter”.
I mean set stop loss and set profit in the same time....
another question :
If i want to exit to end of bar, i want to code it...what i write in my script? I have to generate order intrabar or not?
Thank you
I mean set stop loss and set profit in the same time....
another question :
If i want to exit to end of bar, i want to code it...what i write in my script? I have to generate order intrabar or not?
Thank you
- Anna MultiCharts
- Posts: 560
- Joined: 14 Jul 2017
- Has thanked: 42 times
- Been thanked: 141 times
Re: Stop loss and Take Profit....Code
Shivax,
Please, try to use Sell and BuyToCover commands for market or price orders depending on your needs. If you need an order to be placed straight after the generation, please, use IOG. To place an order on the bar close – don’t use IOG.
Please, refer to these links for more info:
https://www.multicharts.com/trading-sof ... egy_Orders
https://www.multicharts.com/trading-sof ... Generation
Please, try to use Sell and BuyToCover commands for market or price orders depending on your needs. If you need an order to be placed straight after the generation, please, use IOG. To place an order on the bar close – don’t use IOG.
Please, refer to these links for more info:
https://www.multicharts.com/trading-sof ... egy_Orders
https://www.multicharts.com/trading-sof ... Generation
Re: Stop loss and Take Profit....Code
Hello shivax,
maybe you mean something like that
If marketposition=1 then begin
sell nex bar at ....... stop; // StopLoss
sell next bar at...... limit; // take profit
end;
Same using marketposition=-1 but using the Word buytocover
maybe you mean something like that
If marketposition=1 then begin
sell nex bar at ....... stop; // StopLoss
sell next bar at...... limit; // take profit
end;
Same using marketposition=-1 but using the Word buytocover