Hi all
Been playing around with ProRealtime for like 10w now and I have made some profits so far, but I have one problem that maybe someone can help me with.
If this is met
SET TARGET pPROFIT 325
The following trade is 90% a loss. Is there a way to make the program to take a pause/break for some time for ex 12/24/36h after it has hit the target profit?
Best wishes
Daniel
Yes, the best is pausing the strategy for N bars (you know how many bars it takes to pause 1, 4 or 48 hours).
Add the variable TradeON to your conditions to trade:
ONCE TradeON = 1
ONCE PauseBars = 20
ONCE Count = 0
IF TradeON = 0 THEN
Count = Count - 1
TradeON = (Count = 0)
ENDIF
IF StrategyProfit > StrategyProfit[1] THEN
Count = PauseBars
TradeON = 0
ENDIF
IF MyLongConditions AND TradeON THEN
BUY.....
ENDIF
Hi Roberto and tank you for your fast reply
I have sofar just used the simplyfied creation, so all this is new to me. I post the full code and mb you can tell me where and how to make your code fit?
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
indicator1 = ExponentialAverage[20](close)
indicator2 = ExponentialAverage[100](close)
c1 = (indicator1 CROSSES OVER indicator2)
IF c1 THEN
BUY 5 CONTRACT AT MARKET
ENDIF
// Conditions to exit long positions
indicator3 = ExponentialAverage[20](close)
indicator4 = ExponentialAverage[100](close)
c2 = (indicator3 CROSSES UNDER indicator4)
IF c2 THEN
SELL AT MARKET
ENDIF
// Stops and targets
SET TARGET pPROFIT 325
There you go:
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
ONCE TradeON = 1
ONCE PauseBars = 20
ONCE Count = 0
IF TradeON = 0 THEN
Count = Count - 1
TradeON = (Count = 0)
ENDIF
IF StrategyProfit > StrategyProfit[1] THEN
Count = PauseBars
TradeON = 0
ENDIF
// Conditions to enter long positions
indicator1 = ExponentialAverage[20](close)
indicator2 = ExponentialAverage[100](close)
c1 = (indicator1 CROSSES OVER indicator2)
IF c1 AND TradeON THEN
BUY 5 CONTRACT AT MARKET
ENDIF
// Conditions to exit long positions
indicator3 = ExponentialAverage[20](close)
indicator4 = ExponentialAverage[100](close)
c2 = (indicator3 CROSSES UNDER indicator4)
IF c2 AND TradeON THEN
SELL AT MARKET
ENDIF
// Stops and targets
SET TARGET pPROFIT 325
Tank you so much, I got it working and is now trying out different values and backtesting. But now it makes a pause after every winning trade, so both when “Condition to exit long position” makes a profit and “stops and targets” are met. Is there a way to make it only pause after the “Stops and target(set target pProfit(325))” is met?
There you go:
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
ONCE TradeON = 1
ONCE PauseBars = 20
ONCE Count = 0
ONCE PauseTrading = 1
IF TradeON = 0 THEN
Count = Count - 1
TradeON = (Count = 0)
ENDIF
IF StrategyProfit > StrategyProfit[1] AND PauseTrading THEN
Count = PauseBars
TradeON = 0
ENDIF
// Conditions to enter long positions
indicator1 = ExponentialAverage[20](close)
indicator2 = ExponentialAverage[100](close)
c1 = (indicator1 CROSSES OVER indicator2)
IF c1 AND TradeON THEN
BUY 5 CONTRACT AT MARKET
PauseTrading = 1
ENDIF
// Conditions to exit long positions
indicator3 = ExponentialAverage[20](close)
indicator4 = ExponentialAverage[100](close)
c2 = (indicator3 CROSSES UNDER indicator4)
IF c2 AND TradeON THEN
SELL AT MARKET
PauseTrading = 0
ENDIF
// Stops and targets
SET TARGET pPROFIT 325
Tank you so very much Roberto, you truly are a king among men!