I use this simple strategy.
I want that this strategy is only allowed to trade twice (or any other number) a day.
The strategy must start at 9am every day, regardless of whether the day before closed with a profit.
// Definitie van code parameters
DEFPARAM CumulateOrders = False // Opstapelen posities gedeactiveerd
// Het systeem zal alle lopende orders annuleren en alle posities sluiten om 0:00. Er zijn geen nieuwe toegestaan totdat na de "FLATBEFORE" tijd.
DEFPARAM CumulateOrders=false
DefParam FlatBefore = 090000
DefParam FlatAfter = 230000
MyConditions = (open <= WeightedAverage[14](medianPrice))
Once TradeON = 1
If IntraDayBarIndex = 0 then
TradeON = 2
Endif
If OnMarket or StrategyProfit <> StrategyProfit[1] Then
TradeON = 0
endif
If MyConditions and TradeON and Not OnMarket Then
Sellshort 10 CONTRACT AT MARKET
Endif
// Voorkomt dat het systeem handelt op specifieke dagen van de week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
// Stops and targets
//SET STOP ptrailing 15
SET TARGET pPROFIT 1.5
There you go:
// Definitie van code parameters
DEFPARAM CumulateOrders = False // Opstapelen posities gedeactiveerd
// Het systeem zal alle lopende orders annuleren en alle posities sluiten om 0:00. Er zijn geen nieuwe toegestaan totdat na de "FLATBEFORE" tijd.
DefParam FlatBefore = 090000
DefParam FlatAfter = 230000
// Voorkomt dat het systeem handelt op specifieke dagen van de week
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
MyConditions = (open <= WeightedAverage[14](medianPrice))
Once TradeON = 2
If IntraDayBarIndex = 0 then
TradeON = 2
Endif
//If OnMarket or StrategyProfit <> StrategyProfit[1] Then
//TradeON = 0
//endif
If MyConditions and TradeON and Not DaysForbiddenEntry and time >= 090000 and time <= 230000 and Not OnMarket Then
Sellshort 10 CONTRACT AT MARKET
TradeON = TradeON - 1
Endif
// Stops and targets
//SET STOP ptrailing 15
SET TARGET pPROFIT 10
graph MyConditions
graph TradeON
1.5 pips for the stop loss was too little to work.
<span class=”Y2IQFc” lang=”en”>Hi Roberto, thank you for your help.
I have one more question, my “system” buys every morning from 9 am, and closes at 11 pm.
Can i also program it to allow him to buy every day from 9 am, but not close at 11pm.
Only close when 10 points profit is achieved, no matter how many days this takes.</span>