Trasformare Strategia in Screener
Forums › ProRealTime forum Italiano › Supporto ProScreener › Trasformare Strategia in Screener
- This topic has 7 replies, 2 voices, and was last updated 6 years ago by robertogozzi.
-
-
07/16/2018 at 10:36 PM #76097
Salve, vorrei utilizzare alcune strategie sui mercati ufficiali, visto che li non è possibile utilizzare il trading automatico vorrei poter convertire una strategia in uno screener (oppure un indicatore), ora nello specifico ci sono alcune strategie che indicano l’eventuale prezzo di entrata, e riporto qui sotto la strategia di breakout esposta da Nicolas e modificata da Ale.
potreste aiutarmi a convertirla? da li poi penso di riuscire a convertire anche le altre differenti che ho.
Grazie.MAIN CODE : BREAKOUT STRATEGY BY NICOLAS123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107// MAIN CODE : BREAKOUT STRATEGY BY NICOLAS, COSMIC1// INSPIRED BY BRAKOUT DAX 15MIN - COSMIC1 AND PROREALCODE SHARING COMMUNITY//-------------------------------------------------------------------------// IG MARKET GERMANY 30 CASH (EUR 1 MINI) - SPREAD 1 - 15 MIN// WE DO NOT STORE DATA UNTIL THE SYSTEM STARTS.// IF IT IS THE FIRST DAY THAT THE SYSTEM IS LAUNCHED AND IF IT IS AFTERNOON,// IT WILL WAIT UNTIL THE NEXT DAY FOR DEFINING SELL AND BUY ORDERS.//ALL TIMES ARE +0200 UTC/GMTDEFPARAM PRELOADBARS = 0// POSITION IS CLOSED AT 21H00 PMDEFPARAM FLATAFTER = 210000// NO NEW POSITION WILL BE INITIATED AFTER THE 16:00PM CANDLESTICK. ANY EXISTING ORDERS CANCELLED AT 17:15PMLIMITHOUR = 181400// MARKET SCAN BEGIN WITH THE 15 MINUTE CANDLESTICK THAT CLOSED AT 9:15AMSTARTHOUR = 091500IF DAYOFWEEK =1 THENTRADINGDAY = 0ELSETRADINGDAY = 1ENDIF// VARIABLES THAT WOULD BE ADAPTED TO YOUR PREFERENCESIF TIME = 080000 THEN//POSITIONSIZE = MAX(1,1+ROUND((STRATEGYPROFIT-1000)/1000)) //GAIN RE-INVEST TRADE VOLUMEPOSITIONSIZE = 1 //CONSTANT TRADE VOLUME OVER THE TIMEENDIFMAXAMPLITUDE = 120MINAMPLITUDE = 60ORDERDISTANCE = 7POURCENTAGEMIN = 20// VARIABLE INITILIZATION ONCE AT SYSTEM STARTONCE STARTTRADINGDAY = -1// VARIABLES THAT CAN CHANGE IN INTRADAY ARE INITILIAZED// AT FIRST BAR ON EACH NEW DAYIF (TIME <= STARTHOUR AND STARTTRADINGDAY <> 0) OR INTRADAYBARINDEX = 0 THENBUYTRESHOLD = 0SELLTRESHOLD = 0BUYPOSITION = 0SELLPOSITION = 0STARTTRADINGDAY = 0ELSIF TIME >= STARTHOUR AND STARTTRADINGDAY = 0 AND TRADINGDAY = 1 THEN// WE STORE THE FIRST TRADING DAY BAR INDEXDAYSTARTINDEX = INTRADAYBARINDEXSTARTTRADINGDAY = 1ELSIF STARTTRADINGDAY = 1 AND TIME <= LIMITHOUR THEN// FOR EACH TRADING DAY, WE DEFINE EACH 15 MINUTES// THE HIGHER AND LOWER PRICE VALUE OF THE INSTRUMENT SINCE STARTHOUR// UNTIL THE BUY AND SELL TRESHOLDS ARE NOT DEFINEDIF BUYTRESHOLD = 0 OR SELLTRESHOLD = 0 THENHIGHLEVEL = HIGHEST[INTRADAYBARINDEX - DAYSTARTINDEX + 1](HIGH)LOWLEVEL = LOWEST [INTRADAYBARINDEX - DAYSTARTINDEX + 1](LOW)// SPREAD CALCULATION BETWEEN THE HIGHER AND THE// LOWER VALUE OF THE INSTRUMENT SINCE STARTHOURDAYSPREAD = HIGHLEVEL - LOWLEVEL// MINIMAL SPREAD CALCULATION ALLOWED TO CONSIDER A SIGNIFICANT PRICE BREAKOUT// OF THE HIGHER AND LOWER VALUEMINSPREAD = DAYSPREAD * POURCENTAGEMIN / 100// BUY AND SELL TRESHOLDS FOR THE ACTUAL IF CONDITIONS ARE METIF DAYSPREAD <= MAXAMPLITUDE THENIF SELLTRESHOLD = 0 AND (CLOSE - LOWLEVEL) >= MINSPREAD THENSELLTRESHOLD = LOWLEVEL + ORDERDISTANCEENDIFIF BUYTRESHOLD = 0 AND (HIGHLEVEL - CLOSE) >= MINSPREAD THENBUYTRESHOLD = HIGHLEVEL - ORDERDISTANCEENDIFENDIFENDIF// CREATION OF THE BUY AND SELL ORDERS FOR THE DAY// IF THE CONDITIONS ARE METIF SELLTRESHOLD > 0 AND BUYTRESHOLD > 0 AND (BUYTRESHOLD - SELLTRESHOLD) >= MINAMPLITUDE THENIF BUYPOSITION = 0 THENIF LONGONMARKET THENBUYPOSITION = 1ELSEBUY POSITIONSIZE CONTRACT AT BUYTRESHOLD STOPENDIFENDIFIF SELLPOSITION = 0 THENIF SHORTONMARKET THENSELLPOSITION = 1ELSESELLSHORT POSITIONSIZE CONTRACT AT SELLTRESHOLD STOPENDIFENDIFENDIF// CONDITIONS DEFINITIONS TO EXIT MARKET WHEN A BUY OR SELL ORDER IS ALREADY LAUNCHEDIF LONGONMARKET AND (TIME> LIMITHOUR) THENSELL AT SELLTRESHOLD STOPELSIF SHORTONMARKET AND (TIME > LIMITHOUR) THENEXITSHORT AT BUYTRESHOLD STOPENDIF//Regards Ale07/16/2018 at 11:16 PM #76100Prova questo codice, ho solo tolto i BUY/SELL SELLSHORT/EXITSHORT, sostituendoli con i seguenti valori da restituire:
- 1 = Buy
- 2 = Sellshort
- 5 = Sell
- 6 = Exitshort
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119// MAIN CODE : BREAKOUT STRATEGY BY NICOLAS, COSMIC1// INSPIRED BY BRAKOUT DAX 15MIN - COSMIC1 AND PROREALCODE SHARING COMMUNITY//-------------------------------------------------------------------------// IG MARKET GERMANY 30 CASH (EUR 1 MINI) - SPREAD 1 - 15 MIN// WE DO NOT STORE DATA UNTIL THE SYSTEM STARTS.// IF IT IS THE FIRST DAY THAT THE SYSTEM IS LAUNCHED AND IF IT IS AFTERNOON,// IT WILL WAIT UNTIL THE NEXT DAY FOR DEFINING SELL AND BUY ORDERS.//ALL TIMES ARE +0200 UTC/GMT//DEFPARAM PRELOADBARS = 0// POSITION IS CLOSED AT 21H00 PM//DEFPARAM FLATAFTER = 210000// NO NEW POSITION WILL BE INITIATED AFTER THE 16:00PM CANDLESTICK. ANY EXISTING ORDERS CANCELLED AT 17:15PMLIMITHOUR = 181400// MARKET SCAN BEGIN WITH THE 15 MINUTE CANDLESTICK THAT CLOSED AT 9:15AMSTARTHOUR = 091500IF DAYOFWEEK =1 THENTRADINGDAY = 0ELSETRADINGDAY = 1ENDIF// VARIABLES THAT WOULD BE ADAPTED TO YOUR PREFERENCES//IF TIME = 080000 THEN//POSITIONSIZE = MAX(1,1+ROUND((STRATEGYPROFIT-1000)/1000)) //GAIN RE-INVEST TRADE VOLUME//POSITIONSIZE = 1 //CONSTANT TRADE VOLUME OVER THE TIME//ENDIFMAXAMPLITUDE = 120MINAMPLITUDE = 60ORDERDISTANCE = 7POURCENTAGEMIN = 20// VARIABLE INITILIZATION ONCE AT SYSTEM STARTONCE STARTTRADINGDAY = -1Result = 0// VARIABLES THAT CAN CHANGE IN INTRADAY ARE INITILIAZED// AT FIRST BAR ON EACH NEW DAYIF (TIME <= STARTHOUR AND STARTTRADINGDAY <> 0) OR INTRADAYBARINDEX = 0 THENBUYTRESHOLD = 0SELLTRESHOLD = 0BUYPOSITION = 0SELLPOSITION = 0STARTTRADINGDAY = 0ELSIF TIME >= STARTHOUR AND STARTTRADINGDAY = 0 AND TRADINGDAY = 1 THEN// WE STORE THE FIRST TRADING DAY BAR INDEXDAYSTARTINDEX = INTRADAYBARINDEXSTARTTRADINGDAY = 1ELSIF STARTTRADINGDAY = 1 AND TIME <= LIMITHOUR THEN// FOR EACH TRADING DAY, WE DEFINE EACH 15 MINUTES// THE HIGHER AND LOWER PRICE VALUE OF THE INSTRUMENT SINCE STARTHOUR// UNTIL THE BUY AND SELL TRESHOLDS ARE NOT DEFINEDIF BUYTRESHOLD = 0 OR SELLTRESHOLD = 0 THENHIGHLEVEL = HIGHEST[INTRADAYBARINDEX - DAYSTARTINDEX + 1](HIGH)LOWLEVEL = LOWEST [INTRADAYBARINDEX - DAYSTARTINDEX + 1](LOW)// SPREAD CALCULATION BETWEEN THE HIGHER AND THE// LOWER VALUE OF THE INSTRUMENT SINCE STARTHOURDAYSPREAD = HIGHLEVEL - LOWLEVEL// MINIMAL SPREAD CALCULATION ALLOWED TO CONSIDER A SIGNIFICANT PRICE BREAKOUT// OF THE HIGHER AND LOWER VALUEMINSPREAD = DAYSPREAD * POURCENTAGEMIN / 100// BUY AND SELL TRESHOLDS FOR THE ACTUAL IF CONDITIONS ARE METIF DAYSPREAD <= MAXAMPLITUDE THENIF SELLTRESHOLD = 0 AND (CLOSE - LOWLEVEL) >= MINSPREAD THENSELLTRESHOLD = LOWLEVEL + ORDERDISTANCEENDIFIF BUYTRESHOLD = 0 AND (HIGHLEVEL - CLOSE) >= MINSPREAD THENBUYTRESHOLD = HIGHLEVEL - ORDERDISTANCEENDIFENDIFENDIF// CREATION OF THE BUY AND SELL ORDERS FOR THE DAY// IF THE CONDITIONS ARE METIF SELLTRESHOLD > 0 AND BUYTRESHOLD > 0 AND (BUYTRESHOLD - SELLTRESHOLD) >= MINAMPLITUDE THENIF BUYPOSITION = 0 THENIF IamLong THENBUYPOSITION = 1ELSEResult = 1//BUY POSITIONSIZE CONTRACT AT BUYTRESHOLD STOPIamLong = 1IamShort = 0ENDIFENDIFIF SELLPOSITION = 0 THENIF IamShort THENSELLPOSITION = 1ELSEResult = 2//SELLSHORT POSITIONSIZE CONTRACT AT SELLTRESHOLD STOPIamLong = 0IamShort = 1ENDIFENDIFENDIF// CONDITIONS DEFINITIONS TO EXIT MARKET WHEN A BUY OR SELL ORDER IS ALREADY LAUNCHEDIF IamLong AND (TIME> LIMITHOUR) THENResult = 5IamLong = 0//SELL AT SELLTRESHOLD STOPELSIF IamShort AND (TIME > LIMITHOUR) THENResult = 6IamShort = 0//EXITSHORT AT BUYTRESHOLD STOPENDIFENDIF//Regards AleSCREENER [Result] (Result as "1256")dovrebbe funzionare, ma ho solo fatto una prova sommaria e mi ha dato pochi risultati su un TF ad 1 ora (su tutti gli strumenti, Forex, Indici, Azioni, Commodities, Cryptovalute).
07/17/2018 at 8:01 AM #7610607/17/2018 at 8:32 AM #76110Invece di uno SCREENER devo trasformarlo in indicatore, provo a farlo.
07/17/2018 at 10:01 AM #76117Provalo
Indicatore123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122// MAIN CODE : BREAKOUT STRATEGY BY NICOLAS, COSMIC1// INSPIRED BY BRAKOUT DAX 15MIN - COSMIC1 AND PROREALCODE SHARING COMMUNITY//-------------------------------------------------------------------------// IG MARKET GERMANY 30 CASH (EUR 1 MINI) - SPREAD 1 - 15 MIN// WE DO NOT STORE DATA UNTIL THE SYSTEM STARTS.// IF IT IS THE FIRST DAY THAT THE SYSTEM IS LAUNCHED AND IF IT IS AFTERNOON,// IT WILL WAIT UNTIL THE NEXT DAY FOR DEFINING SELL AND BUY ORDERS.//ALL TIMES ARE +0200 UTC/GMT//DEFPARAM PRELOADBARS = 0// POSITION IS CLOSED AT 21H00 PM//DEFPARAM FLATAFTER = 210000// NO NEW POSITION WILL BE INITIATED AFTER THE 16:00PM CANDLESTICK. ANY EXISTING ORDERS CANCELLED AT 17:15PMLIMITHOUR = 181400// MARKET SCAN BEGIN WITH THE 15 MINUTE CANDLESTICK THAT CLOSED AT 9:15AMSTARTHOUR = 091500IF DAYOFWEEK =1 THENTRADINGDAY = 0ELSETRADINGDAY = 1ENDIF// VARIABLES THAT WOULD BE ADAPTED TO YOUR PREFERENCES//IF TIME = 080000 THEN//POSITIONSIZE = MAX(1,1+ROUND((STRATEGYPROFIT-1000)/1000)) //GAIN RE-INVEST TRADE VOLUME//POSITIONSIZE = 1 //CONSTANT TRADE VOLUME OVER THE TIME//ENDIFMAXAMPLITUDE = 120MINAMPLITUDE = 60ORDERDISTANCE = 7POURCENTAGEMIN = 20// VARIABLE INITILIZATION ONCE AT SYSTEM STARTONCE STARTTRADINGDAY = -1Result = 0// VARIABLES THAT CAN CHANGE IN INTRADAY ARE INITILIAZED// AT FIRST BAR ON EACH NEW DAYIF (TIME <= STARTHOUR AND STARTTRADINGDAY <> 0) OR INTRADAYBARINDEX = 0 THENBUYTRESHOLD = 0SELLTRESHOLD = 0BUYPOSITION = 0SELLPOSITION = 0STARTTRADINGDAY = 0ELSIF TIME >= STARTHOUR AND STARTTRADINGDAY = 0 AND TRADINGDAY = 1 THEN// WE STORE THE FIRST TRADING DAY BAR INDEXDAYSTARTINDEX = INTRADAYBARINDEXSTARTTRADINGDAY = 1ELSIF STARTTRADINGDAY = 1 AND TIME <= LIMITHOUR THEN// FOR EACH TRADING DAY, WE DEFINE EACH 15 MINUTES// THE HIGHER AND LOWER PRICE VALUE OF THE INSTRUMENT SINCE STARTHOUR// UNTIL THE BUY AND SELL TRESHOLDS ARE NOT DEFINEDIF BUYTRESHOLD = 0 OR SELLTRESHOLD = 0 THENHIGHLEVEL = HIGHEST[INTRADAYBARINDEX - DAYSTARTINDEX + 1](HIGH)LOWLEVEL = LOWEST [INTRADAYBARINDEX - DAYSTARTINDEX + 1](LOW)// SPREAD CALCULATION BETWEEN THE HIGHER AND THE// LOWER VALUE OF THE INSTRUMENT SINCE STARTHOURDAYSPREAD = HIGHLEVEL - LOWLEVEL// MINIMAL SPREAD CALCULATION ALLOWED TO CONSIDER A SIGNIFICANT PRICE BREAKOUT// OF THE HIGHER AND LOWER VALUEMINSPREAD = DAYSPREAD * POURCENTAGEMIN / 100// BUY AND SELL TRESHOLDS FOR THE ACTUAL IF CONDITIONS ARE METIF DAYSPREAD <= MAXAMPLITUDE THENIF SELLTRESHOLD = 0 AND (CLOSE - LOWLEVEL) >= MINSPREAD THENSELLTRESHOLD = LOWLEVEL + ORDERDISTANCEENDIFIF BUYTRESHOLD = 0 AND (HIGHLEVEL - CLOSE) >= MINSPREAD THENBUYTRESHOLD = HIGHLEVEL - ORDERDISTANCEENDIFENDIFENDIF// CREATION OF THE BUY AND SELL ORDERS FOR THE DAY// IF THE CONDITIONS ARE METIF SELLTRESHOLD > 0 AND BUYTRESHOLD > 0 AND (BUYTRESHOLD - SELLTRESHOLD) >= MINAMPLITUDE THENIF BUYPOSITION = 0 THENIF IamLong THENBUYPOSITION = 1ELSEResult = 1//BUY POSITIONSIZE CONTRACT AT BUYTRESHOLD STOPDRAWTEXT("#BUYTRESHOLD#", barindex, high, Dialog, Bold, 10) COLOURED(0,255,0,255)IamLong = 1IamShort = 0ENDIFENDIFIF SELLPOSITION = 0 THENIF IamShort THENSELLPOSITION = 1ELSEResult = 2DRAWTEXT("#SELLTRESHOLD#", barindex, low, Dialog, Bold, 10) COLOURED(255,0,0,255)//SELLSHORT POSITIONSIZE CONTRACT AT SELLTRESHOLD STOPIamLong = 0IamShort = 1ENDIFENDIFENDIF// CONDITIONS DEFINITIONS TO EXIT MARKET WHEN A BUY OR SELL ORDER IS ALREADY LAUNCHEDIF IamLong AND (TIME> LIMITHOUR) THENResult = 5IamLong = 0//SELL AT SELLTRESHOLD STOPELSIF IamShort AND (TIME > LIMITHOUR) THENResult = 6IamShort = 0//EXITSHORT AT BUYTRESHOLD STOPENDIFENDIF//Regards AleIF Result THEN //blocco IF...ENDIF inutile, solo per usare la variabile RESULTENDIFRETURN07/17/2018 at 11:21 AM #7612307/17/2018 at 11:30 AM #7612707/17/2018 at 3:38 PM #76141Si, eccolo:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125// MAIN CODE : BREAKOUT STRATEGY BY NICOLAS, COSMIC1// INSPIRED BY BRAKOUT DAX 15MIN - COSMIC1 AND PROREALCODE SHARING COMMUNITY//-------------------------------------------------------------------------// IG MARKET GERMANY 30 CASH (EUR 1 MINI) - SPREAD 1 - 15 MIN// WE DO NOT STORE DATA UNTIL THE SYSTEM STARTS.// IF IT IS THE FIRST DAY THAT THE SYSTEM IS LAUNCHED AND IF IT IS AFTERNOON,// IT WILL WAIT UNTIL THE NEXT DAY FOR DEFINING SELL AND BUY ORDERS.//ALL TIMES ARE +0200 UTC/GMT//DEFPARAM PRELOADBARS = 0// POSITION IS CLOSED AT 21H00 PM//DEFPARAM FLATAFTER = 210000MyBUYTRESHOLD=0MySELLTRESHOLD=0// NO NEW POSITION WILL BE INITIATED AFTER THE 16:00PM CANDLESTICK. ANY EXISTING ORDERS CANCELLED AT 17:15PMLIMITHOUR = 181400// MARKET SCAN BEGIN WITH THE 15 MINUTE CANDLESTICK THAT CLOSED AT 9:15AMSTARTHOUR = 091500IF DAYOFWEEK =1 THENTRADINGDAY = 0ELSETRADINGDAY = 1ENDIF// VARIABLES THAT WOULD BE ADAPTED TO YOUR PREFERENCES//IF TIME = 080000 THEN//POSITIONSIZE = MAX(1,1+ROUND((STRATEGYPROFIT-1000)/1000)) //GAIN RE-INVEST TRADE VOLUME//POSITIONSIZE = 1 //CONSTANT TRADE VOLUME OVER THE TIME//ENDIFMAXAMPLITUDE = 120MINAMPLITUDE = 60ORDERDISTANCE = 7POURCENTAGEMIN = 20// VARIABLE INITILIZATION ONCE AT SYSTEM STARTONCE STARTTRADINGDAY = -1Result = 0// VARIABLES THAT CAN CHANGE IN INTRADAY ARE INITILIAZED// AT FIRST BAR ON EACH NEW DAYIF (TIME <= STARTHOUR AND STARTTRADINGDAY <> 0) OR INTRADAYBARINDEX = 0 THENBUYTRESHOLD = 0SELLTRESHOLD = 0BUYPOSITION = 0SELLPOSITION = 0STARTTRADINGDAY = 0ELSIF TIME >= STARTHOUR AND STARTTRADINGDAY = 0 AND TRADINGDAY = 1 THEN// WE STORE THE FIRST TRADING DAY BAR INDEXDAYSTARTINDEX = INTRADAYBARINDEXSTARTTRADINGDAY = 1ELSIF STARTTRADINGDAY = 1 AND TIME <= LIMITHOUR THEN// FOR EACH TRADING DAY, WE DEFINE EACH 15 MINUTES// THE HIGHER AND LOWER PRICE VALUE OF THE INSTRUMENT SINCE STARTHOUR// UNTIL THE BUY AND SELL TRESHOLDS ARE NOT DEFINEDIF BUYTRESHOLD = 0 OR SELLTRESHOLD = 0 THENHIGHLEVEL = HIGHEST[INTRADAYBARINDEX - DAYSTARTINDEX + 1](HIGH)LOWLEVEL = LOWEST [INTRADAYBARINDEX - DAYSTARTINDEX + 1](LOW)// SPREAD CALCULATION BETWEEN THE HIGHER AND THE// LOWER VALUE OF THE INSTRUMENT SINCE STARTHOURDAYSPREAD = HIGHLEVEL - LOWLEVEL// MINIMAL SPREAD CALCULATION ALLOWED TO CONSIDER A SIGNIFICANT PRICE BREAKOUT// OF THE HIGHER AND LOWER VALUEMINSPREAD = DAYSPREAD * POURCENTAGEMIN / 100// BUY AND SELL TRESHOLDS FOR THE ACTUAL IF CONDITIONS ARE METIF DAYSPREAD <= MAXAMPLITUDE THENIF SELLTRESHOLD = 0 AND (CLOSE - LOWLEVEL) >= MINSPREAD THENSELLTRESHOLD = LOWLEVEL + ORDERDISTANCEENDIFIF BUYTRESHOLD = 0 AND (HIGHLEVEL - CLOSE) >= MINSPREAD THENBUYTRESHOLD = HIGHLEVEL - ORDERDISTANCEENDIFENDIFENDIF// CREATION OF THE BUY AND SELL ORDERS FOR THE DAY// IF THE CONDITIONS ARE METIF SELLTRESHOLD > 0 AND BUYTRESHOLD > 0 AND (BUYTRESHOLD - SELLTRESHOLD) >= MINAMPLITUDE THENIF BUYPOSITION = 0 THENIF IamLong THENBUYPOSITION = 1ELSEResult = 1//BUY POSITIONSIZE CONTRACT AT BUYTRESHOLD STOP//DRAWTEXT("#BUYTRESHOLD#", barindex, high, Dialog, Bold, 10) COLOURED(0,255,0,255)MyBUYTRESHOLD=BUYTRESHOLDIamLong = 1IamShort = 0ENDIFENDIFIF SELLPOSITION = 0 THENIF IamShort THENSELLPOSITION = 1ELSEResult = 2//DRAWTEXT("#SELLTRESHOLD#", barindex, low, Dialog, Bold, 10) COLOURED(255,0,0,255)//SELLSHORT POSITIONSIZE CONTRACT AT SELLTRESHOLD STOPMySELLTRESHOLD=SELLTRESHOLDIamLong = 0IamShort = 1ENDIFENDIFENDIF// CONDITIONS DEFINITIONS TO EXIT MARKET WHEN A BUY OR SELL ORDER IS ALREADY LAUNCHEDIF IamLong AND (TIME> LIMITHOUR) THENResult = 5IamLong = 0//SELL AT SELLTRESHOLD STOPELSIF IamShort AND (TIME > LIMITHOUR) THENResult = 6IamShort = 0//EXITSHORT AT BUYTRESHOLD STOPENDIFENDIF//Regards AleIF Result THEN //blocco IF...ENDIF inutile, solo per usare la variabile RESULTENDIFRETURN MyBUYTRESHOLD,MySELLTRESHOLD -
AuthorPosts
Find exclusive trading pro-tools on