Hello, 
I am new here. 
My problem is following: I want to calculate entire profile likelihood function (and then find maximum value) in order to find threshold estimate and run TVECM model. Therefore I want to build script (with loop programming) which will calculate just entire profile likelihood function in Gretl. The other estimations I can perform myself. 
Here is my request formulated below: 
# Model: TVECM (Threshold Vector Error Correction Model)
# Name of my variables: dependent variable - Y (Price on market 1); independent variables - X (Price on market 2) and ECT (Error correction term)
# My data sample runs from 2006:10 to 2014:08
# First, I need to generate variables "difference of Y", "difference of X", "Lagged value of ECT", "lagged value of diff_Y", and "lagged value of diff_X"
# "Lagged value of ECT" is my threshold variable - Threshold value must come from it. 
# My final target is to calculate the entire profile likelihood function of ols regression and save results in a separate file (let's say "LF.gdt")
# Below is my guess how the process must be solved. Could you adjust it to my data and help me to complete?
------------script----------------
loop i=2006:10..2014:08 --progressive --quiet
    genr  
    ols 
    genr LF = $lnl
    store "C:\.....\.....\......\LF.gdt" LF
endloop

Thank you!
Kind regards, 
Miranda