/* ** scenario02.txt - restriction scenario(set maximum amplitude ratios from the initial price). ** (C) Copyright 2005 Yosuke Amijima. All Rights Reserved. ** ** Purpose: Get the status whether or not path S is restricted. ** ** Format: status=scenario02(S,maxupratio,maxdownratio); ** ** Input: S vector, a path to be determined whether or not it is used ** ** maxupratio scalar, maximum upswing amplitude ratio from S0 ** ** maxdownratio scalar, maximum downswing amplitude rate from S0 ** ** ** Output: status scalar, 1 if restricted, 0 otherwise ** ** Example If maxupratio=2 and maxdownratio=0.5, it means 0.5*S0 <= S <= 2*S0 leading to 0. */ proc scenario02(S,maxupratio,maxdownratio); /* looking upswing */ if maxc(S)>maxupratio*S[1]; retp(1); endif; /* looking downswing */ if minc(S)