Values of Optimization based on CAR/MOD

hi all

how to get the value of Optimization based on the first HI of CAR/MOD and the second HI of CAR/MOD for the optimized parameters .

#include "Formulas/Custom/INDCFormula.opt.afl"
mfast = Optimize( "MACD Fast", MACD_fast_param, 8, 16, 1 );
mslow = Optimize("MACD Slow", MACD_slow_param, 17, 30, 1 );
sigavg = Optimize( "Signal average", MACD_Signal_param, 2, 20, 1 );



Buy = Cross( MACD( mfast, mslow ) , Signal( mfast, mslow, sigavg ) );
Sell = Cross( Signal( mfast, mslow, sigavg ), MACD( mfast, mslow ) );
CAR_MOD_V1 =  ?  ; // new1 value after Optimization 
mfast_V1 =   ?  ;        // new1 value after Optimization
mslow_V1 =   ?   ;       // new 1value after Optimization
sigavg_V1 = ? ;       // new1 value after Optimization
CAR_MOD_V2 =  ?  ; // new2 value after Optimization 
mfast_V2 =   ?  ;        // new2 value after Optimization
mslow_V2 =   ?   ;       // new2 value after Optimization
sigavg_V2 = ? ;       // new2 value after Optimization

Filter = Status("lastbarinrange");
AddColumn( Buy, "Buy" );
AddColumn( Sell, "Sell" );
AddColumn( CAR_MOD_V1, "CAR/MOD VALUE1" );
AddColumn( mfast_V1, "mfast_V1" );
AddColumn( mslow_V1, "mslow_V1" );
AddColumn( sigavg_V1, "sigavg_V1" );
AddColumn( CAR_MOD_V2, "CAR/MOD VALUE2" );
AddColumn( mfast_V2, "mfast_V2" );
AddColumn( mslow_V2, "mslow_V2" );
AddColumn( sigavg_V2, "sigavg_V2" );

thank you

I think the right way to solve it as flow
1- Create folder let us call it ( optimization parameter )
2- Exporting optimization vai afl to cv file

A - exporting two line based on highest CAR/MOD with the single ticker
ticker, CAR/MOD, macd_fast, macd_slow, macd_signal, rsi ,mfi
AAPL, .96, 8, 23, 4, 19 ,27
AAPL, .94, 8, 21, 4, 13 ,18

or
B - exporting two line based on highest CAR/MOD ( the watch list )tickers
ticker, CAR/MOD, macd_fast, macd_slow, macd_signal, rsi ,mfi
AAPL, .96, 8, 23, 4, 19 ,27
AAPL, .94, 8, 21, 4, 13 ,18
MSFT, .92,9, 24, 7, 21 ,17
MSFT, .87, 5, 27, 5, 15 ,16
AMZN, .94, 6, 19, 3, 18 ,20
AMZN, .92, 7, 26, 5, 17 ,19

3- after the cv is created with new parameters I can use the parameters based on the ticker if exist

I hope the idea is clear

Hi

i create folder that will contain ( .opt.afl ) by tricker as flow

path =   "C:\\Program Files\\AmiBroker\\Formulas\\Custom\\MainOptimiz\\";// main directory for the path and folder name

fmkdir(path); // create thefolder 

fh = fopen( path + Name() + ".opt.afl", "w" );

    
    if ( fh )
{

    // write Optimize Params
    fputs( "Fast_macd = 12 ;\nSlow_macd = 26 ;\nSing_macd = 9 ;\n", fh );

    }
  
 fclose( fh ); 
   
Fast_macd = 12 ;
Slow_macd = 26 ;
Sing_macd = 9 ;
#include "Formulas/Custom/MainOptimiz"+ Name() +".opt.afl"
mfast = Optimize( "Fast_macd", Fast_macd, 8, 16, 1 );
mslow = Optimize("Sing_macd", Sing_macd, 17, 30, 1 );
sigavg = Optimize( "Sing_macd", Sing_macd, 2, 20, 1 );

SetOption("OptimizeSaveParams", 1 );

Buy = Cross( MACD( mfast, mslow ) , Signal( mfast, mslow, sigavg ) );
Sell = Cross( Signal( mfast, mslow, sigavg ), MACD( mfast, mslow ) );

  

but i get error

i do not know why

about Title it should be "CAR/MDD" not CAR/MOD
as far as I know AB will give result by "CAR/MDD"
thank you

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.